diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Parameter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Parameter.java new file mode 100644 index 0000000000000000000000000000000000000000..9f23c7860ede9bf35b1e36c010d13f160dc61ec0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Parameter.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface Parameter extends CmmnElement { + + String getName(); + + void setName(String name); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/ParameterMapping.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/ParameterMapping.java new file mode 100644 index 0000000000000000000000000000000000000000..6b49bb5fb76be6af83bdccf2fdce09258e53a150 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/ParameterMapping.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface ParameterMapping extends CmmnElement { + + Parameter getSource(); + + void setSource(Parameter parameter); + + Parameter getTarget(); + + void setTarget(Parameter parameter); + + TransformationExpression getTransformation(); + + void setTransformation(TransformationExpression transformationExpression); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanFragment.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanFragment.java new file mode 100644 index 0000000000000000000000000000000000000000..15ee88f27eede150f80dad9d2a675743ce08c034 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanFragment.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public interface PlanFragment extends PlanItemDefinition { + + Collection getPlanItems(); + + Collection getSentrys(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItem.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItem.java new file mode 100644 index 0000000000000000000000000000000000000000..c334e4ca543eb43ff24ebe88600aa743758d230b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItem.java @@ -0,0 +1,60 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public interface PlanItem extends CmmnElement { + + String getName(); + + void setName(String name); + + PlanItemDefinition getDefinition(); + + void setDefinition(PlanItemDefinition definition); + + @Deprecated + Collection getEntryCriterias(); + + @Deprecated + Collection getExitCriterias(); + + /** + * @return an immutable collection + */ + Collection getEntryCriteria(); + + /** + * @return an immutable collection + */ + Collection getExitCriteria(); + + Collection getEntryCriterions(); + + Collection getExitCriterions(); + + ItemControl getItemControl(); + + void setItemControl(ItemControl itemControl); + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemControl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemControl.java new file mode 100644 index 0000000000000000000000000000000000000000..ce2483a3c0f18d44b06b5efc474c72eadb59913d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemControl.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface PlanItemControl extends CmmnElement { + + RepetitionRule getRepetitionRule(); + + void setRepetitionRule(RepetitionRule repetitionRule); + + RequiredRule getRequiredRule(); + + void setRequiredRule(RequiredRule requiredRule); + + ManualActivationRule getManualActivationRule(); + + void setManualActivationRule(ManualActivationRule manualActivationRule); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemDefinition.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemDefinition.java new file mode 100644 index 0000000000000000000000000000000000000000..34239fda6e6c4103614088faed1f5a259711fd98 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemDefinition.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface PlanItemDefinition extends CmmnElement { + + String getName(); + + void setName(String name); + + DefaultControl getDefaultControl(); + + void setDefaultControl(DefaultControl defaultControl); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemOnPart.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemOnPart.java new file mode 100644 index 0000000000000000000000000000000000000000..efb4dce6a87131afd5ce71df0def294f2a4a154b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemOnPart.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import org.camunda.bpm.model.cmmn.PlanItemTransition; + +/** + * @author Roman Smirnov + * + */ +public interface PlanItemOnPart extends OnPart { + + @Deprecated + Sentry getSentry(); + + @Deprecated + void setSentry(Sentry sentry); + + ExitCriterion getExitCriterion(); + + void setExitCriterion(ExitCriterion exitCriterion); + + PlanItem getSource(); + + void setSource(PlanItem source); + + PlanItemTransition getStandardEvent(); + + void setStandardEvent(PlanItemTransition standardEvent); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemStartTrigger.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemStartTrigger.java new file mode 100644 index 0000000000000000000000000000000000000000..b3003a6c00b5d68f50ed5c0dbd2a1b1528b64e2f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemStartTrigger.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import org.camunda.bpm.model.cmmn.PlanItemTransition; + +/** + * @author Roman Smirnov + * + */ +public interface PlanItemStartTrigger extends StartTrigger { + + PlanItem getSource(); + + void setSource(PlanItem source); + + PlanItemTransition getStandardEvent(); + + void setStandardEvent(PlanItemTransition standardEvent); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemTransitionStandardEvent.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemTransitionStandardEvent.java new file mode 100644 index 0000000000000000000000000000000000000000..8bbb57d87e3cfcf8e13a12c591d098e8aa3bfb13 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanItemTransitionStandardEvent.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import org.camunda.bpm.model.cmmn.PlanItemTransition; + +public interface PlanItemTransitionStandardEvent extends CmmnModelElementInstance { + + PlanItemTransition getValue(); + + void setValue(PlanItemTransition value); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanningTable.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanningTable.java new file mode 100644 index 0000000000000000000000000000000000000000..537ebebfb5310a43bd1fdeecbf182249671a45c9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/PlanningTable.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public interface PlanningTable extends TableItem { + + Collection getTableItems(); + + Collection getApplicabilityRules(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Process.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Process.java new file mode 100644 index 0000000000000000000000000000000000000000..443da942155382fa0735dc1582f78de632507859 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Process.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public interface Process extends CmmnElement { + + String getName(); + + void setName(String name); + + String getImplementationType(); + + void setImplementationType(String implementationType); + + Collection getInputs(); + + Collection getOutputs(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/ProcessParameter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/ProcessParameter.java new file mode 100644 index 0000000000000000000000000000000000000000..cf3c5aac63d8d781e2927646283089b44fbe2596 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/ProcessParameter.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface ProcessParameter extends Parameter { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/ProcessRefExpression.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/ProcessRefExpression.java new file mode 100644 index 0000000000000000000000000000000000000000..454d8e2d432e3ca97fe76ca3261370ae70ff5405 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/ProcessRefExpression.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface ProcessRefExpression extends Expression { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/ProcessTask.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/ProcessTask.java new file mode 100644 index 0000000000000000000000000000000000000000..71f56e6e292c669f4a7ae3572984fa4c313b2929 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/ProcessTask.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public interface ProcessTask extends Task { + + String getProcess(); + + void setProcess(String process); + + ProcessRefExpression getProcessExpression(); + + void setProcessExpression(ProcessRefExpression processExpression); + + Collection getParameterMappings(); + + /** camunda extensions */ + + String getCamundaProcessBinding(); + + void setCamundaProcessBinding(String camundaProcessBinding); + + String getCamundaProcessVersion(); + + void setCamundaProcessVersion(String camundaProcessVersion); + + String getCamundaProcessTenantId(); + + void setCamundaProcessTenantId(String camundaProcessTenantId); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Property.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Property.java new file mode 100644 index 0000000000000000000000000000000000000000..4ab92919dded026b25c4f505a59021d8fe289ca1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Property.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface Property extends CmmnElement { + + String getName(); + + void setName(String name); + + String getType(); + + void setType(String type); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Relationship.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Relationship.java new file mode 100644 index 0000000000000000000000000000000000000000..35d655da208c2a8bc4132ea35c889b5e067df9e7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Relationship.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.RelationshipDirection; + +/** + * @author Roman Smirnov + * + */ +public interface Relationship extends CmmnElement { + + String getType(); + + void setType(String type); + + RelationshipDirection getDirection(); + + void setDirection(RelationshipDirection direction); + + Collection getSources(); + + Collection getTargets(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/RepetitionRule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/RepetitionRule.java new file mode 100644 index 0000000000000000000000000000000000000000..481ff9dd0357ff336fa46a290a0985c1a3df416d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/RepetitionRule.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface RepetitionRule extends CmmnElement { + + String getName(); + + void setName(String name); + + CaseFileItem getContext(); + + void setContext(CaseFileItem caseFileItem); + + ConditionExpression getCondition(); + + void setCondition(ConditionExpression condition); + + /** Camunda extensions */ + + String getCamundaRepeatOnStandardEvent(); + + void setCamundaRepeatOnStandardEvent(String standardEvent); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/RequiredRule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/RequiredRule.java new file mode 100644 index 0000000000000000000000000000000000000000..b98c624f5207a2897abac19b94514b13f077225b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/RequiredRule.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface RequiredRule extends CmmnElement { + + String getName(); + + void setName(String name); + + CaseFileItem getContext(); + + void setContext(CaseFileItem caseFileItem); + + ConditionExpression getCondition(); + + void setCondition(ConditionExpression condition); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Role.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Role.java new file mode 100644 index 0000000000000000000000000000000000000000..d6fffa7d1da462b56d8d3c07b77d53488c7eeb88 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Role.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface Role extends CmmnElement { + + String getName(); + + void setName(String name); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Sentry.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Sentry.java new file mode 100644 index 0000000000000000000000000000000000000000..7c0b7bedb3269683d301ba72f37cb53d39b9ec0a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Sentry.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public interface Sentry extends CmmnElement { + + String getName(); + + void setName(String name); + + Collection getOnParts(); + + IfPart getIfPart(); + + void setIfPart(IfPart ifPart); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Source.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Source.java new file mode 100644 index 0000000000000000000000000000000000000000..4c70a85d5d9cb6c3ffe9d09d20fe45ce9a6e8cc2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Source.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface Source extends CmmnModelElementInstance { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Stage.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Stage.java new file mode 100644 index 0000000000000000000000000000000000000000..c6925dc83c741eac2080cbda1a2722eb9071c2d0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Stage.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public interface Stage extends PlanFragment { + + boolean isAutoComplete(); + + void setAutoComplete(boolean autoComplete); + + @Deprecated + Collection getExitCriterias(); + + Collection getExitCriteria(); + + Collection getExitCriterions(); + + PlanningTable getPlanningTable(); + + void setPlanningTable(PlanningTable planningTable); + + Collection getPlanItemDefinitions(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/StartTrigger.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/StartTrigger.java new file mode 100644 index 0000000000000000000000000000000000000000..9fe435c044566045955d6fcf8e3391987f9c70d0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/StartTrigger.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface StartTrigger extends CmmnElement { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TableItem.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TableItem.java new file mode 100644 index 0000000000000000000000000000000000000000..46d15a729e48291e8be0f649c5bfee95ba3c97c4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TableItem.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public interface TableItem extends CmmnElement { + + Collection getApplicabilityRule(); + + Collection getAuthorizedRoles(); + + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Target.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Target.java new file mode 100644 index 0000000000000000000000000000000000000000..4206e1276b9deddd25ae494ff15403d87a74cdf0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Target.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface Target extends CmmnModelElementInstance { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Task.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Task.java new file mode 100644 index 0000000000000000000000000000000000000000..b751c12e5425255c30d9461e630f36a601ff6f73 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Task.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public interface Task extends PlanItemDefinition { + + boolean isBlocking(); + + void setIsBlocking(boolean isBlocking); + + @Deprecated + Collection getInputs(); + + @Deprecated + Collection getOutputs(); + + Collection getInputParameters(); + + Collection getOutputParameters(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Text.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Text.java new file mode 100644 index 0000000000000000000000000000000000000000..760b09e03167ab984cf1ef51bb6ea4d26d815216 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/Text.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface Text extends CmmnModelElementInstance { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TextAnnotation.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TextAnnotation.java new file mode 100644 index 0000000000000000000000000000000000000000..3d828922ca07966554bb89d37af1faa982c8aae2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TextAnnotation.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface TextAnnotation extends Artifact { + + String getTextFormat(); + + void setTextFormat(String textFormat); + + Text getText(); + + void setText(Text text); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TimerEvent.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TimerEvent.java new file mode 100644 index 0000000000000000000000000000000000000000..81f057156ddc18998bb16b2e8bd05814fa030b5e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TimerEvent.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface TimerEvent extends Event { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TimerEventListener.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TimerEventListener.java new file mode 100644 index 0000000000000000000000000000000000000000..fea2560e2c76bbc11d7cce5de5d2e28cd4c336bd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TimerEventListener.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface TimerEventListener extends EventListener { + + TimerExpression getTimerExpression(); + + void setTimerExpression(TimerExpression timerExpression); + + StartTrigger getTimerStart(); + + void setTimerStart(StartTrigger timerStart); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TimerExpression.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TimerExpression.java new file mode 100644 index 0000000000000000000000000000000000000000..6be90ad95fdf06de3b3a730d410e1c7dada091aa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TimerExpression.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface TimerExpression extends Expression { + +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TransformationExpression.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TransformationExpression.java new file mode 100644 index 0000000000000000000000000000000000000000..a440b38424fb281dba6b41386d34323cfbd8b4a2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/TransformationExpression.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface TransformationExpression extends Expression { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/UserEvent.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/UserEvent.java new file mode 100644 index 0000000000000000000000000000000000000000..41244fbc616358dd5df51e8ca68d146724a45ab3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/UserEvent.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +/** + * @author Roman Smirnov + * + */ +public interface UserEvent extends Event { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/UserEventListener.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/UserEventListener.java new file mode 100644 index 0000000000000000000000000000000000000000..5a5fcc904582661177b518d5299d74972992d773 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/UserEventListener.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public interface UserEventListener extends EventListener { + + Collection getAuthorizedRoles(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaCaseExecutionListener.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaCaseExecutionListener.java new file mode 100644 index 0000000000000000000000000000000000000000..e770d7dc3d4a3ccd3161e70a6d6bec64d251fb04 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaCaseExecutionListener.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance; + +/** + * @author Roman Smirnov + * + */ +public interface CamundaCaseExecutionListener extends CmmnModelElementInstance { + + String getCamundaEvent(); + + void setCamundaEvent(String camundaEvent); + + String getCamundaClass(); + + void setCamundaClass(String camundaClass); + + String getCamundaExpression(); + + void setCamundaExpression(String camundaExpression); + + String getCamundaDelegateExpression(); + + void setCamundaDelegateExpression(String camundaDelegateExpression); + + CamundaScript getCamundaScript(); + + void setCamundaScript(CamundaScript camundaScript); + + Collection getCamundaFields(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaExpression.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaExpression.java new file mode 100644 index 0000000000000000000000000000000000000000..b370efafee0726bd58d374219c13eb750cc1dcaa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaExpression.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance; + +/** + * @author Roman Smirnov + * + */ +public interface CamundaExpression extends CmmnModelElementInstance { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaField.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaField.java new file mode 100644 index 0000000000000000000000000000000000000000..57c60f72dcfcc268bf30a0a1cc2bd252d978267c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaField.java @@ -0,0 +1,47 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance; + +/** + * @author Roman Smirnov + * + */ +public interface CamundaField extends CmmnModelElementInstance { + + String getCamundaName(); + + void setCamundaName(String camundaName); + + String getCamundaExpression(); + + void setCamundaExpression(String camundaExpression); + + String getCamundaStringValue(); + + void setCamundaStringValue(String camundaStringValue); + + CamundaString getCamundaString(); + + void setCamundaString(CamundaString camundaString); + + CamundaExpression getCamundaExpressionChild(); + + void setCamundaExpressionChild(CamundaExpression camundaExpression); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaIn.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaIn.java new file mode 100644 index 0000000000000000000000000000000000000000..430aa06d67e639f11924f4333db198da07d55c30 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaIn.java @@ -0,0 +1,55 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance; + + +/** + * The CMMN in camunda extension element + * + * @author Sebastian Menski + * @author Roman Smirnov + * + */ +public interface CamundaIn extends CmmnModelElementInstance { + + String getCamundaSource(); + + void setCamundaSource(String camundaSource); + + String getCamundaSourceExpression(); + + void setCamundaSourceExpression(String camundaSourceExpression); + + String getCamundaVariables(); + + void setCamundaVariables(String camundaVariables); + + String getCamundaTarget(); + + void setCamundaTarget(String camundaTarget); + + String getCamundaBusinessKey(); + + void setCamundaBusinessKey(String camundaBusinessKey); + + boolean getCamundaLocal(); + + void setCamundaLocal(boolean local); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaOut.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaOut.java new file mode 100644 index 0000000000000000000000000000000000000000..4b239278a5084aaebe92ad93b07602b65a442bdf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaOut.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance; + +/** + * The CMMN out camunda extension element + * + * @author Sebastian Menski + * @author Roman Smirnov + * + */ +public interface CamundaOut extends CmmnModelElementInstance { + + String getCamundaSource(); + + void setCamundaSource(String camundaSource); + + String getCamundaSourceExpression(); + + void setCamundaSourceExpression(String camundaSourceExpression); + + String getCamundaVariables(); + + void setCamundaVariables(String camundaVariables); + + String getCamundaTarget(); + + void setCamundaTarget(String camundaTarget); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaScript.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaScript.java new file mode 100644 index 0000000000000000000000000000000000000000..8987c21d6e07216de37e66541ac5bfadee1f4e5d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaScript.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance; + +/** + * @author Roman Smirnov + * + */ +public interface CamundaScript extends CmmnModelElementInstance { + + String getCamundaScriptFormat(); + + void setCamundaScriptFormat(String scriptFormat); + + String getCamundaResource(); + + void setCamundaResoure(String resource); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaString.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaString.java new file mode 100644 index 0000000000000000000000000000000000000000..edc19ad4d67c36d9eaec7a7662ba6e89c60fb620 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaString.java @@ -0,0 +1,26 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance; + +/** + * @author Roman Smirnov + * + */ +public interface CamundaString extends CmmnModelElementInstance { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaTaskListener.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaTaskListener.java new file mode 100644 index 0000000000000000000000000000000000000000..4f83a953e3bb5709e28335a364f51de0bb24b392 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaTaskListener.java @@ -0,0 +1,50 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance; + +/** + * @author Roman Smirnov + * + */ +public interface CamundaTaskListener extends CmmnModelElementInstance { + + String getCamundaEvent(); + + void setCamundaEvent(String camundaEvent); + + String getCamundaClass(); + + void setCamundaClass(String camundaClass); + + String getCamundaExpression(); + + void setCamundaExpression(String camundaExpression); + + String getCamundaDelegateExpression(); + + void setCamundaDelegateExpression(String camundaDelegateExpression); + + CamundaScript getCamundaScript(); + + void setCamundaScript(CamundaScript camundaScript); + + Collection getCamundaFields(); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableListener.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableListener.java new file mode 100644 index 0000000000000000000000000000000000000000..4226a3bb31b528f8f88981b1ca04e9a6562cdfaf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableListener.java @@ -0,0 +1,50 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance; + +/** + * @author Thorben Lindhauer + * + */ +public interface CamundaVariableListener extends CmmnModelElementInstance { + + String getCamundaEvent(); + + void setCamundaEvent(String camundaEvent); + + String getCamundaClass(); + + void setCamundaClass(String camundaClass); + + String getCamundaExpression(); + + void setCamundaExpression(String camundaExpression); + + String getCamundaDelegateExpression(); + + void setCamundaDelegateExpression(String camundaDelegateExpression); + + Collection getCamundaFields(); + + CamundaScript getCamundaScript(); + + void setCamundaScript(CamundaScript camundaScript); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableOnPart.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableOnPart.java new file mode 100644 index 0000000000000000000000000000000000000000..6efb3e602e6b2597a195a4a6df833216d15898cd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableOnPart.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import org.camunda.bpm.model.cmmn.VariableTransition; +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance; +/** + * + * @author Deivarayan Azhagappan + * + */ +public interface CamundaVariableOnPart extends CmmnModelElementInstance { + + String getVariableName(); + + void setVariableName(String variableName); + + VariableTransition getVariableEvent(); + + void setVariableEvent(VariableTransition standardEvent); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableTransitionEvent.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableTransitionEvent.java new file mode 100644 index 0000000000000000000000000000000000000000..4ee7d64354915917a12da658988592f6182e7c5f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableTransitionEvent.java @@ -0,0 +1,32 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import org.camunda.bpm.model.cmmn.VariableTransition; +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance; +/** + * + * @author Deivarayan Azhagappan + * + */ +public interface CamundaVariableTransitionEvent extends CmmnModelElementInstance { + + VariableTransition getValue(); + + void setValue(VariableTransition value); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn10/CMMN10.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn10/CMMN10.xsd new file mode 100644 index 0000000000000000000000000000000000000000..bf9fdb18a8b24fc376815e59d7df10ed9229ad0b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn10/CMMN10.xsd @@ -0,0 +1,64 @@ + + + + + + + Include the CMMN 1.0 Case Model XML-Schema in the same namespace. + + + + + + + + + definitions is the root element of ALL CMMN elements. It is used as a container + for CMMN elements that might be re-used. + + + + + + + + tDefinitions defines the type of element "definitions". + + + + + + + + + + + + + + + + + + + + + + + + import is the root element for all imports in CMMN definitions. + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn10/CMMN10CaseModel.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn10/CMMN10CaseModel.xsd new file mode 100644 index 0000000000000000000000000000000000000000..1e9a7bfe55d57f4bfee82d86d97543dec97f95b8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn10/CMMN10CaseModel.xsd @@ -0,0 +1,1090 @@ + + + + + + + + tCmmnElement is the base type for ALL CMMN complex types except tExpression. + + + + + + + + + + + + + + + tCmmnElementWithMixedContent is the base type for complex type tExpression. It is + identical to tCmmnElement except that it allows for mixed content. + + + + + + + + + + + + + + + + tExtensionElements allows to extend the specified meta model in a way that it is + still CMMN-compliant. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + case is the root element for all CMMN case models. It is the container + for the Case File and Plan Model. + + + + + + + tCase defines the type of element "case". + + + + + + + + + + + + + + + + + + + + role is the root element for Case Roles. + + + + + + + tRole defines the type of element "role". + + + + + + + + + + + + + + planItemControl is the root element for Case Plan Control elements + including the RepetitionRule, RequiredRule and ManualActivationRule. + + + + + + + tPlanItemcontrol defines the type of element "planItemControl". + + + + + + + + + + + + + + + + + repetitionRule is the root element for specifying a + repetition rule for a PlanItemDefinition element. + + + + + + + tRepetitionRule defines the type of element "repetitionRule". + + + + + + + + + + + + contextRef MUST refer a CaseFileItem if specified. + + + + + + + + + + + requiredRule is the root element for specifying a + required rule for a PlanItemDefinition element. + + + + + + + tRequiredRule defines the type of element "requiredRule". + + + + + + + + + + + + contextRef MUST refer a CaseFileItem if specified. + + + + + + + + + + + manualActivationRule is the root element for specifying an + manual activation rule for a PlanItemDefinition element. + + + + + + + tManualActivationRule defines the type of element "manualActivationRule". + + + + + + + + + + + + contextRef MUST refer a CaseFileItem if specified. + + + + + + + + + + + + caseFile is the root element for the CMMN Case File Model + and is a container for CaseFileItems. + + + + + + + tCaseFile defines the type of element "caseFile". + + + + + + + + + + + + + + + caseFileItem is the root element for CMMN data. + + + + + + + tCaseFileItem defines the type of element "caseFileItem". + + + + + + + + + + + + + definitinRef MUST refer to a "caseFileItemDefinition" element. Since + CaseFileItemDefinition is re-usable, QName is used for reference. + + + + + + + sourceRef MUST refer to a "caseFileItem" element in the case where this + "caseFileItem" has a parent. + + + + + + + If this "caseFileItem" maintains references to "caseFileItem" childs, then + targetRefs MUST refer to "caseFileItem" elements; the targets of this caseFileItem. + + + + + + + + + + + tChildren defines a container for zero or more "caseFileItem" elements. + + + + + + + + + + + + + + + caseFileItemDefinition defines the type of a "caseFileItem". + + + + + + + tCaseFileItemDefinition defines the type of element "caseFileItemDefinition" + + + + + + + + + + + + + structureRef refers a structure, for example an XML-Schema element + in a XSD referred by importRef + + + + + + + importRef refers an "import" element under "definitions" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + task represents an (abstract) Task in the Case Model and comprises + of inputs, outputs and a flag if the task is blocking or not. + + + + + + + + + + + + + + + + + + + event represents an (abstract) Event in the Case Model. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bindingRef refers a "caseFileItem" element + + + + + + + + + + + + + + + + + + + humanTask represents a HumanTask in the Case Model and comprises of + zero or one PlanningTable and a reference to a Role (the performer of + the human task). + + + + + + + tHumanTask defines the type of element "humanTask" + + + + + + + + + + + performerRef refers a "role" element + + + + + + + + + + + processTask represents a ProcessTask in the Case Model and comprises of + ParameterMappings and a reference to an (abstract) Process. + + + + + + + tProcessTask defines the type of element "process" + + + + + + + + + + + processRef refers a "process" element which is re-usable and can + be imported via some other file. + + + + + + + + + + + process represents an (abstract) Business Process in CMMN. It has + a implementationType, inputs and outputs and can be referred from + a ProcessTask. + + + + + + + tProcess defines the type of element "process" + + + + + + + + + + + + + + + + + + Enumeration of Business Process standards known to CMMN 1.0 + + + + + + + + + + + + + + + + + + + + caseTask is the root element for CaseTask in the Case Model and + comprises of ParameterMappings and a reference to a Case + + + + + + + tCaseTask defines the type of element "caseTask" + + + + + + + + + + + caseRef refers a "case" element which is re-usable and can + be imported via some other file. + + + + + + + + + + + + + + + + + + sourceRef refers a "parameter" element + + + + + + + targetRef refers a "parameter" element + + + + + + + + + + + + + + + + + + + + + + + + + timerExpression is supposed to be an ISO-8601 conformant expression + + + + + + + timerStart can be used to trigger the timer after a PlanItem or CaseFileItem + lifecycle state transition has occurred. + + + + + + + + + + + + + + + + + + + + + + + + + + + sourceRef refers a "caseFileItem" element + + + + + + + + + + + + + + + + + + sourceRef refers a "planItem" element + + + + + + + + + + + + sentry is the root element of "Sentry" in the Case Model and + comprises of zero or more OnParts and zero or one IfPart. + + + + + + + tSentry defines the type of element "sentry" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sourceRef refers a "caseFileItem" element + + + + + + + + + + + + + + + + + + sourceRef refers a "planItem" element + + + + + + + sentryRef refers a "Sentry" element + + + + + + + + + + + + + + + + + + contextRef refers a "caseFileItem" element + + + + + + + + + + + Enumeration of CaseFileItem transitions. + + + + + + + + + + + + + + + + + + Enumeration of PlanItem transitions. + + + + + + + + + + + + + + + + + + + + + + + + + + + + planFragment is the root element for PlanItems that should go into + the plan as a unit. + + + + + + + tPlanFragment defines the type for element "planFragment" + + + + + + + + + + + + + + + + stage represents a Stage in the Case Model and comprises of + zero or one PlanningTable, zero or more PlanItemDefinition elements + and if the Stage is the outermost Stage, zero or more references to + exit criteria Sentries. + + + + + + + tStage defines the type for element "stage" + + + + + + + + + + + + + exitCriteriaRefs refers zero or more "sentry" elements. + + + + + + + + + + + + + + + + + + + definitionRef refers a "planItemDefinition" element. + + + + + + + entryCriteriaRefs refers "sentry" elements. + + + + + + + exitCriteriaRefs refers "sentry" elements. + + + + + + + + + + + + + + + + applicabilityRuleRefs refers one or more "applicabilityRule" elements. + + + + + + + authorizedRoleRefs refers zero or more "role" elements. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + definitionRef refers a "planItemDefinition" element + + + + + + + + + + + + + + + + + + contexRef refers a "caseFileItem" element + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/CMMN11.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/CMMN11.xsd new file mode 100644 index 0000000000000000000000000000000000000000..8ca379b96cacb3aa34122d7c256322d6d9f3a0c8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/CMMN11.xsd @@ -0,0 +1,78 @@ + + + + + + + Include the CMMN 1.1 Case Model XML-Schema in the same namespace. + + + + + + + + Include the CMMN 1.1 Diagram Interchange (DI) schema + + + + + + + + + definitions is the root element of ALL CMMN elements. It is used as a container + for CMMN elements that might be re-used. + + + + + + + + tDefinitions defines the type of element "definitions". + + + + + + + + + + + + + + + + + + + + + + + + + + + + import is the root element for all imports in CMMN definitions. + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/CMMN11CaseModel.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/CMMN11CaseModel.xsd new file mode 100644 index 0000000000000000000000000000000000000000..20a8db0e22331a7a6b19746ad79a2f00bf17277c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/CMMN11CaseModel.xsd @@ -0,0 +1,1337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + tCmmnElement is the base type for ALL CMMN complex types except tExpression. + + + + + + + + + + + + + + + tCmmnElementWithMixedContent is the base type for complex type tExpression + and tDocumentation. It is identical to tCmmnElement except that it allows + for mixed content. + + + + + + + + + + + + + + + + + + + + + + + + case is the root element for all CMMN case models. It is the container + for the Case File and Plan Model. + + + + + + + tCase defines the type of element "case". + + + + + + + + + + + + + + + + + + + + tCaseRoles defines the type of element "caseRoles inside tCase". + + + + + + + + + + + + + + + role is the root element for Case Roles. + + + + + + + tRole defines the type of element "role". + + + + + + + + + + + + + + planItemControl is the root element for Case Plan Control elements + including the RepetitionRule, RequiredRule and ManualActivationRule. + + + + + + + tPlanItemcontrol defines the type of element "planItemControl". + + + + + + + + + + + + + + + + + repetitionRule is the root element for specifying a + repetition rule for a PlanItemDefinition element. + + + + + + + tRepetitionRule defines the type of element "repetitionRule". + + + + + + + + + + + + contextRef MUST refer a CaseFileItem if specified. + + + + + + + + + + + requiredRule is the root element for specifying a + required rule for a PlanItemDefinition element. + + + + + + + tRequiredRule defines the type of element "requiredRule". + + + + + + + + + + + + contextRef MUST refer a CaseFileItem if specified. + + + + + + + + + + + manualActivationRule is the root element for specifying an + manual activation rule for a PlanItemDefinition element. + + + + + + + tManualActivationRule defines the type of element "manualActivationRule". + + + + + + + + + + + + contextRef MUST refer a CaseFileItem if specified. + + + + + + + + + + + + caseFile is the root element for the CMMN Case File Model + and is a container for CaseFileItems. + + + + + + + tCaseFile defines the type of element "caseFile". + + + + + + + + + + + + + + + + caseFileItem is the root element for CMMN data. + + + + + + + tCaseFileItem defines the type of element "caseFileItem". + + + + + + + + + + + + + definitinRef MUST refer to a "caseFileItemDefinition" element. Since + CaseFileItemDefinition is re-usable, QName is used for reference. + + + + + + + sourceRef MUST refer to a "caseFileItem" element in the case where this + "caseFileItem" has a parent. + + + + + + + If this "caseFileItem" maintains references to "caseFileItem" childs, then + targetRefs MUST refer to "caseFileItem" elements; the targets of this caseFileItem. + + + + + + + + + + + tChildren defines a container for zero or more "caseFileItem" elements. + + + + + + + + + + + + + + + caseFileItemDefinition defines the type of a "caseFileItem". + + + + + + + tCaseFileItemDefinition defines the type of element "caseFileItemDefinition" + + + + + + + + + + + + + structureRef refers a structure, for example an XML-Schema element + in a XSD referred by importRef + + + + + + + importRef refers an "import" element under "definitions" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + task represents an (abstract) Task in the Case Model and comprises + of input, output and a flag if the task is blocking or not. + + + + + + + + + + + + + + + + + + + event represents an (abstract) Event in the Case Model. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bindingRef refers a "caseFileItem" element + + + + + + + + + + + + + + + + + + + + + + + + + + + humanTask represents a HumanTask in the Case Model and comprises of + zero or one PlanningTable and a reference to a Role (the performer of + the human task). + + + + + + + tHumanTask defines the type of element "humanTask" + + + + + + + + + + + performerRef refers a "role" element + + + + + + + + + + + processTask represents a ProcessTask in the Case Model and comprises of + ParameterMappings and a reference to an (abstract) Process. + + + + + + + tProcessTask defines the type of element "process" + + + + + + + + + + processRefExpression is mutually exclusive to processRef. It allows the selection of a + process at runtime via an expression rather then at design time with processRef. + + + + + + + + processRef refers a "process" element which is re-usable and can + be imported via some other file. processRef is mutually exclusive to processRefExpression + + + + + + + + + + + process represents an (abstract) Business Process in CMMN. It has + an implementationType, input and output and can be referred from + a ProcessTask. + + + + + + + tProcess defines the type of element "process" + + + + + + + + + + + + + + + + + + + Enumeration of Business Process standards known to CMMN 1.1 + + + + + + + + + + + + + + + + + + + + caseTask is the root element for CaseTask in the Case Model and + comprises of ParameterMappings and a reference to a Case + + + + + + + tCaseTask defines the type of element "caseTask" + + + + + + + + + + caseRefExpression is mutualy exclusive to caseRef and can be used to select a case + at runtime rather then specifying caseRef at design-time. + + + + + + + + caseRef refers a "case" element which is re-usable and can + be imported via some other file. caseRef is mutually exclusive to "caseRefExpression" + + + + + + + + + + + decisionTask represents a DecisionTask in the Case Model and comprises of + ParameterMappings and a reference to an (abstract) Decision. + + + + + + + tDecisionTask defines the type of element "decision" + + + + + + + + + + decisionRefExpression is mutually exclusive to decisionRef. It allows the selection of a + decision at runtime via an expression rather then at design time with decisionRef. + + + + + + + + decisionRef refers a "decision" element which is re-usable and can + be imported via some other file. decisionRef is mutually exclusive to decisionRefExpression + + + + + + + + + + + decision represents an (abstract) Decision in CMMN. It has + an implementationType, input and output and can be referred from + a DecisionTask. + + + + + + + tDecision defines the type of element "decision" + + + + + + + + + + + + + + + + + + + Enumeration of Decision standards known to CMMN 1.1 + + + + + + + + + + + + + + + + + + + + + + + + sourceRef refers a "parameter" element + + + + + + + targetRef refers a "parameter" element + + + + + + + + + + + + + + + + authorizedRoleRefs refers zero or more "role" elements. + + + + + + + + + + + + + + + + + timerExpression is supposed to be an ISO-8601 conformant expression + + + + + + + timerStart can be used to trigger the timer after a PlanItem or CaseFileItem + lifecycle state transition has occurred. + + + + + + + + + + + + + + + + + + + + + + + + + + + sourceRef refers a "caseFileItem" element + + + + + + + + + + + + + + + + + + sourceRef refers a "planItem" element + + + + + + + + + + + + sentry is the root element of "Sentry" in the Case Model and + comprises of zero or more OnParts and zero or one IfPart. + + + + + + + tSentry defines the type of element "sentry" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sourceRef refers a "caseFileItem" element + + + + + + + + + + + + + + + + + + sourceRef refers a "planItem" element + + + + + + + exitCriterionRef refers a "ExitCriterion" element that is contained in the + "planItem" referred by sourceRef + + + + + + + + + + + + + + + + + + contextRef refers a "caseFileItem" element + + + + + + + + + + + Enumeration of CaseFileItem transitions. + + + + + + + + + + + + + + + + + + Enumeration of PlanItem transitions. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Criterion is the abstract base class for EntryCriterion and ExitCriterion. It is + primarily used for CMMN Diagram Interchange (CMMN DI). + + + + + + + sentryRef refers to an existing Sentry in this casePlanModel + + + + + + + + + + + + + + EntryCriterion is a place holder for Entry Criteria and is primarily used for + CMMN Diagram Interchange (CMMN DI) + + + + + + + + + + + + + ExitCriterion is a place holder for Exit Criteria and is primarily used for + CMMN Diagram Interchange (CMMN DI) + + + + + + + + + + + + planFragment is the root element for PlanItems that should go into + the plan as a unit. + + + + + + + tPlanFragment defines the type for element "planFragment" + + + + + + + + + + + + + + + + stage represents a Stage in the Case Model and comprises of + zero or one PlanningTable, zero or more PlanItemDefinition elements + and if the Stage is the outermost Stage, zero or more references to + exitCriterion. + + + + + + + + tStage defines the type for element "stage" + + + + + + + + + + + + + + + + + + + + + + + + + + + + definitionRef refers a "planItemDefinition" element. + + + + + + + + + + + + + + + + applicabilityRuleRefs refers one or more "applicabilityRule" elements. + + + + + + + authorizedRoleRefs refers zero or more "role" elements. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + definitionRef refers a "planItemDefinition" element + + + + + + + + + + + + + + + + + + + contexRef refers a "caseFileItem" element + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/CMMNDI11.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/CMMNDI11.xsd new file mode 100644 index 0000000000000000000000000000000000000000..cfc9c8307816492d59947abc754fc3f4642d8fe3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/CMMNDI11.xsd @@ -0,0 +1,89 @@ + + + + + + + + + This element should never be instantiated directly, but rather concrete implementation should. It is placed there only to be referred in the sequence + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/DC.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/DC.xsd new file mode 100644 index 0000000000000000000000000000000000000000..0bf852472ee7d7425f2a12296b5627f3027972d6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/DC.xsd @@ -0,0 +1,150 @@ + + + + + + + + + Color is a data type that represents a color value in the RGB format. + + + + + + + + + + + + + + A Point specifies an location in some x-y coordinate system. + + + + + + + Dimension specifies two lengths (width and height) along the x and y axes in some x-y coordinate system. + + + + + + + Bounds specifies a rectangular area in some x-y coordinate system that is defined by a location (x and y) and a size (width and height). + + + + + + + + + AlignmentKind enumerates the possible options for alignment for layout purposes. + + + + + + + + + + KnownColor is an enumeration of 17 known colors. + + + + + a color with a value of #800000 + + + + + a color with a value of #FF0000 + + + + + a color with a value of #FFA500 + + + + + a color with a value of #FFFF00 + + + + + a color with a value of #808000 + + + + + a color with a value of #800080 + + + + + a color with a value of #FF00FF + + + + + a color with a value of #FFFFFF + + + + + a color with a value of #00FF00 + + + + + a color with a value of #008000 + + + + + a color with a value of #000080 + + + + + a color with a value of #0000FF + + + + + a color with a value of #00FFFF + + + + + a color with a value of #008080 + + + + + a color with a value of #000000 + + + + + a color with a value of #C0C0C0 + + + + + a color with a value of #808080 + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/DI.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/DI.xsd new file mode 100644 index 0000000000000000000000000000000000000000..c80cba306e0bec4b1f6e31a9d9cef3bd73164a83 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/main/resources/org/camunda/bpm/model/cmmn/schema/cmmn11/DI.xsd @@ -0,0 +1,107 @@ + + + + + The Diagram Interchange (DI) package enables interchange of graphical information that language users have control over, such as position of nodes and line routing points. Language specifications specialize elements of DI to define diagram interchange elements for a language. + + + + This element should never be instantiated directly, but rather concrete implementation should. It is placed there only to be referred in the sequence + + + + + DiagramElement is the abstract super type of all elements in diagrams, including diagrams themselves. When contained in a diagram, diagram elements are laid out relative to the diagram's origin. + + + + + + + + + + + + an optional locally-owned style for this diagram element. + + + + + + a reference to an optional shared style element for this diagram element. + + + + + + + + + + + + an optional list of points relative to the origin of the nesting diagram that specifies the connected line segments of the edge + + + + + + + + + + + + the name of the diagram. + + + + + the documentation of the diagram. + + + + + the resolution of the diagram expressed in user units per inch. + + + + + + + + + + + + the optional bounds of the shape relative to the origin of its nesting plane. + + + + + + + + + Style contains formatting properties that affect the appearance or style of diagram elements, including diagram themselves. + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/CmmnModelInstanceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/CmmnModelInstanceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..fc312180036aafc04c9c1a11f1b9497cf2c8fbbe --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/CmmnModelInstanceTest.java @@ -0,0 +1,47 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn; + +import org.camunda.bpm.model.cmmn.instance.Definitions; +import org.junit.Test; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +/** + * @author Filip Hrisafov + */ +public class CmmnModelInstanceTest { + + @Test + public void testClone() throws Exception { + + CmmnModelInstance modelInstance = Cmmn.createEmptyModel(); + + Definitions definitions = modelInstance.newInstance(Definitions.class); + definitions.setId("TestId"); + modelInstance.setDefinitions(definitions); + + CmmnModelInstance cloneInstance = modelInstance.clone(); + cloneInstance.getDefinitions().setId("TestId2"); + + assertThat(modelInstance.getDefinitions().getId(), is(equalTo("TestId"))); + assertThat(cloneInstance.getDefinitions().getId(), is(equalTo("TestId2"))); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/CmmnModelTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/CmmnModelTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d80581d2fd1a6a9dccd786972e16bda250784f95 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/CmmnModelTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn; + +import org.camunda.bpm.model.cmmn.util.ParseCmmnModelRule; +import org.junit.Before; +import org.junit.Rule; + +/** + * @author Roman Smirnov + * + */ +public abstract class CmmnModelTest { + + @Rule + public final ParseCmmnModelRule parseCmmnModelRule = new ParseCmmnModelRule(); + + protected CmmnModelInstance cmmnModelInstance; + + @Before + public void setup() { + cmmnModelInstance = parseCmmnModelRule.getCmmnModel(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/CmmnTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/CmmnTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c4b66bc33184ee1e659d6f5fbb13f277f9d68966 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/CmmnTest.java @@ -0,0 +1,34 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; + +/** + * @author Roman Smirnov + * + */ +public class CmmnTest { + + @Test + public void testCmmn() { + assertThat(Cmmn.INSTANCE).isNotNull(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/CreateModelTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/CreateModelTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c33ae9cf5ff54fb62bdda9b6ab56a9bec6072de8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/CreateModelTest.java @@ -0,0 +1,98 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn; + +import org.camunda.bpm.model.cmmn.instance.Case; +import org.camunda.bpm.model.cmmn.instance.CasePlanModel; +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance; +import org.camunda.bpm.model.cmmn.instance.Definitions; +import org.camunda.bpm.model.cmmn.instance.HumanTask; +import org.camunda.bpm.model.cmmn.instance.PlanItem; +import org.camunda.bpm.model.cmmn.instance.Stage; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * @author Sebastian Menski + */ +public class CreateModelTest { + + public CmmnModelInstance modelInstance; + public Definitions definitions; + public Process process; + + @Before + public void createEmptyModel() { + modelInstance = Cmmn.createEmptyModel(); + definitions = modelInstance.newInstance(Definitions.class); + definitions.setTargetNamespace("http://camunda.org/examples"); + modelInstance.setDefinitions(definitions); + } + + protected T createElement(CmmnModelElementInstance parentElement, String id, Class elementClass) { + T element = modelInstance.newInstance(elementClass); + element.setAttributeValue("id", id, true); + parentElement.addChildElement(element); + return element; + } + + @Test + public void createCaseWithOneHumanTask() { + // create process + Case caseInstance = createElement(definitions, "case-with-one-human-task", Case.class); + + // create case plan model + CasePlanModel casePlanModel = createElement(caseInstance, "casePlanModel_1", CasePlanModel.class); + + // create elements + HumanTask humanTask = createElement(casePlanModel, "HumanTask_1", HumanTask.class); + + // create a plan item + PlanItem planItem = createElement(casePlanModel, "PlanItem_1", PlanItem.class); + + // set definition to human task + planItem.setDefinition(humanTask); + } + + @Test + public void createCaseWithOneStageAndNestedHumanTask() { + // create process + Case caseInstance = createElement(definitions, "case-with-one-human-task", Case.class); + + // create case plan model + CasePlanModel casePlanModel = createElement(caseInstance, "casePlanModel_1", CasePlanModel.class); + + // create a stage + Stage stage = createElement(casePlanModel, "Stage_1", Stage.class); + + // create elements + HumanTask humanTask = createElement(stage, "HumanTask_1", HumanTask.class); + + // create a plan item + PlanItem planItem = createElement(stage, "PlanItem_1", PlanItem.class); + + // set definition to human task + planItem.setDefinition(humanTask); + } + + @After + public void validateModel() { + Cmmn.validateModel(modelInstance); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/GenerateIdTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/GenerateIdTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5bbad3b3366272420ac117567581f607042f80ee --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/GenerateIdTest.java @@ -0,0 +1,65 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.instance.CaseFileItemTransitionStandardEventImpl; +import org.camunda.bpm.model.cmmn.instance.Case; +import org.camunda.bpm.model.cmmn.instance.CasePlanModel; +import org.camunda.bpm.model.cmmn.instance.DefaultControl; +import org.camunda.bpm.model.cmmn.instance.Definitions; +import org.camunda.bpm.model.cmmn.instance.HumanTask; +import org.junit.Test; + +public class GenerateIdTest { + + @Test + public void shouldNotGenerateIdsOnRead() { + CmmnModelInstance modelInstance = Cmmn.readModelFromStream(GenerateIdTest.class.getResourceAsStream("GenerateIdTest.cmmn")); + Definitions definitions = modelInstance.getDefinitions(); + assertThat(definitions.getId()).isNull(); + + Case caseElement = modelInstance.getModelElementsByType(Case.class).iterator().next(); + assertThat(caseElement.getId()).isNull(); + + CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next(); + assertThat(casePlanModel.getId()).isNull(); + + HumanTask humanTask = modelInstance.getModelElementsByType(HumanTask.class).iterator().next(); + assertThat(humanTask.getId()).isNull(); + } + + @Test + public void shouldGenerateIdsOnCreate() { + CmmnModelInstance modelInstance = Cmmn.createEmptyModel(); + Definitions definitions = modelInstance.newInstance(Definitions.class); + assertThat(definitions.getId()).isNotNull(); + + Case caseElement = modelInstance.newInstance(Case.class); + assertThat(caseElement.getId()).isNotNull(); + + CasePlanModel casePlanModel = modelInstance.newInstance(CasePlanModel.class); + assertThat(casePlanModel.getId()).isNotNull(); + + HumanTask humanTask = modelInstance.newInstance(HumanTask.class); + assertThat(humanTask.getId()).isNotNull(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/SimpleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/SimpleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..821cbe9c6d9c378de60c18f3c88cc2085c5845d8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/SimpleTest.java @@ -0,0 +1,74 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.Case; +import org.camunda.bpm.model.cmmn.instance.CasePlanModel; +import org.camunda.bpm.model.cmmn.instance.HumanTask; +import org.camunda.bpm.model.cmmn.instance.PlanItem; +import org.camunda.bpm.model.cmmn.instance.PlanItemDefinition; +import org.camunda.bpm.model.cmmn.util.CmmnModelResource; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.junit.Test; + +/** + * @author Roman Smirnov + * + */ +public class SimpleTest extends CmmnModelTest { + + @Test + @CmmnModelResource + public void shouldGetElements() { + + ModelElementInstance modelElementById = cmmnModelInstance.getModelElementById("Case_1"); + assertThat(modelElementById).isNotNull(); + + Collection caseElements = cmmnModelInstance.getDefinitions().getCases(); + assertThat(caseElements).hasSize(1); + Case caseElement = caseElements.iterator().next(); + + assertThat(caseElement.getId()).isEqualTo("Case_1"); + assertThat(caseElement.getName()).isNull(); + + CasePlanModel casePlanModel = caseElement.getCasePlanModel(); + assertThat(casePlanModel).isNotNull(); + + assertThat(casePlanModel.getId()).isEqualTo("CasePlanModel_1"); + + Collection planItemDefinitions = casePlanModel.getPlanItemDefinitions(); + assertThat(planItemDefinitions).hasSize(1); + + PlanItemDefinition planItemDefinition = planItemDefinitions.iterator().next(); + + assertThat(planItemDefinition).isInstanceOf(HumanTask.class); + assertThat(planItemDefinition.getId()).isEqualTo("HumanTask_1"); + assertThat(planItemDefinition.getName()).isEqualTo("A HumanTask"); + + Collection planItems = casePlanModel.getPlanItems(); + + PlanItem planItem = planItems.iterator().next(); + + assertThat(planItem.getId()).isEqualTo("PI_HumanTask_1"); + assertThat(planItem.getDefinition()).isEqualTo(planItemDefinition); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ApplicabilityRuleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ApplicabilityRuleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..536ea76fd0fe26d4ea947394d97a2868400954a7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ApplicabilityRuleTest.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ApplicabilityRuleTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(ConditionExpression.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("contextRef"), + new AttributeAssumption("name") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ArtifactTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ArtifactTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1f525beebeeeea3ce3b7db7d7d5ee71c2d2558d8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ArtifactTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ArtifactTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(true); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/AssociationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/AssociationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1588a90a95fcf85ff55b65ac73b234b77e982271 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/AssociationTest.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class AssociationTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Artifact.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("sourceRef"), + new AttributeAssumption("targetRef"), + new AttributeAssumption("associationDirection") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/BindingRefinementExpressionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/BindingRefinementExpressionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9813b3aba17c526aa669d6a3ae229fe76c1a2de5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/BindingRefinementExpressionTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class BindingRefinementExpressionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Expression.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/BodyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/BodyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e47e7e4b5d716be4b9cc1c5dd2598288706db51c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/BodyTest.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class BodyTest extends CmmnModelElementInstanceTest { + + public String getDefaultNamespace() { + return CmmnModelConstants.CMMN10_NS; + } + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemDefinitionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemDefinitionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ac33492347dcc108ab39c0ba622bf435de5975f2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemDefinitionTest.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class CaseFileItemDefinitionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Property.class) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name"), + new AttributeAssumption("definitionType", false, false, "http://www.omg.org/spec/CMMN/DefinitionType/Unspecified"), + new AttributeAssumption("structureRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemOnPartTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemOnPartTest.java new file mode 100644 index 0000000000000000000000000000000000000000..cbf3033da0823391cf5d48f29ee173a1ae92748b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemOnPartTest.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class CaseFileItemOnPartTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(OnPart.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(CaseFileItemTransitionStandardEvent.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("sourceRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemStartTriggerTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemStartTriggerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6d02e9feb676c0be07cf60f51701a284a2ba3d7f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemStartTriggerTest.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class CaseFileItemStartTriggerTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(StartTrigger.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(CaseFileItemTransitionStandardEvent.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("sourceRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b32db77b2a08a834b39f1fbc768409d471384fab --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemTest.java @@ -0,0 +1,52 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.MultiplicityEnum; +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class CaseFileItemTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Children.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name"), + new AttributeAssumption("multiplicity", false, false, MultiplicityEnum.Unspecified), + new AttributeAssumption("definitionRef"), + new AttributeAssumption(CmmnModelConstants.CMMN10_NS, "sourceRef"), + new AttributeAssumption("sourceRefs"), + new AttributeAssumption("targetRefs") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemTransitionStandardEventTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemTransitionStandardEventTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e1458144a19f5703e9984abbd71a78605ea99227 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileItemTransitionStandardEventTest.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstanceTest; + +/** + * @author Roman Smirnov + * + */ +public class CaseFileItemTransitionStandardEventTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileModelTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileModelTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e2352936684ff8fe3b0c8a13e8f1f0ab7d8b4e8d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileModelTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class CaseFileModelTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CaseFile.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileTest.java new file mode 100644 index 0000000000000000000000000000000000000000..dcdc6b6a5bb4fdf647bd8654a9f4a7c6a7625745 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseFileTest.java @@ -0,0 +1,42 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class CaseFileTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(CaseFileItem.class) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d058bb2d5e4b93fcf839b60ed6544c190aa242b8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseParameterTest.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class CaseParameterTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Parameter.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(BindingRefinementExpression.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("bindingRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CasePlanModelTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CasePlanModelTest.java new file mode 100644 index 0000000000000000000000000000000000000000..64a913b74c70b26edc70e87b85b714914b8bca4d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CasePlanModelTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class CasePlanModelTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Stage.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseRefExpressionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseRefExpressionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1b9a249038931c861bea46a7b67d292e35c87862 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseRefExpressionTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class CaseRefExpressionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Expression.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseRoleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseRoleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bd3021a157c2b8384e7f1637419ecf7e8c1b9d97 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseRoleTest.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class CaseRoleTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnModelConstants.CMMN10_NS, Role.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseRolesTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseRolesTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f43c615d2f788c9e44531a23f914c83456050c01 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseRolesTest.java @@ -0,0 +1,42 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class CaseRolesTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Role.class) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseTaskTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseTaskTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7d1f162d7e1e7df63f1a8df8c9cacfa100fb6ea6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseTaskTest.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class CaseTaskTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Task.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(ParameterMapping.class), + new ChildElementAssumption(CaseRefExpression.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("caseRef"), + new AttributeAssumption(CAMUNDA_NS, "caseBinding"), + new AttributeAssumption(CAMUNDA_NS, "caseVersion"), + new AttributeAssumption(CAMUNDA_NS, "caseTenantId") + ); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9fcaee18a3efcdc3526de6c0980cbcf41e248931 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CaseTest.java @@ -0,0 +1,52 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class CaseTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(CaseFileModel.class, 0, 1), + new ChildElementAssumption(CasePlanModel.class, 0, 1), + new ChildElementAssumption(CmmnModelConstants.CMMN10_NS, CaseRole.class), + new ChildElementAssumption(CaseRoles.class, 0, 1), + new ChildElementAssumption(InputCaseParameter.class), + new ChildElementAssumption(OutputCaseParameter.class) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name"), + new AttributeAssumption(CmmnModelConstants.CAMUNDA_NS, "historyTimeToLive") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ChildrenTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ChildrenTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a034a08a77b430392af80613fa79806e10199567 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ChildrenTest.java @@ -0,0 +1,42 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ChildrenTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(CaseFileItem.class) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CmmnElementTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CmmnElementTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3a9e671b9d531fb99761d43fe6230e788357096d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CmmnElementTest.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class CmmnElementTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(true); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Documentation.class), + new ChildElementAssumption(ExtensionElements.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("id", true), + new AttributeAssumption(CmmnModelConstants.CMMN10_NS, "description") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CmmnModelElementInstanceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CmmnModelElementInstanceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3a9f28b9aa2f474d8aa83d473de8833e25a0829f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CmmnModelElementInstanceTest.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; +import org.camunda.bpm.model.cmmn.util.GetCmmnModelElementTypeRule; +import org.camunda.bpm.model.xml.test.AbstractModelElementInstanceTest; +import org.junit.BeforeClass; +import org.junit.ClassRule; + +/** + * @author Roman Smirnov + * + */ +public abstract class CmmnModelElementInstanceTest extends AbstractModelElementInstanceTest { + + @ClassRule + public static final GetCmmnModelElementTypeRule modelElementTypeRule = new GetCmmnModelElementTypeRule(); + + @BeforeClass + public static void initModelElementType() { + initModelElementType(modelElementTypeRule); + } + + public String getDefaultNamespace() { + return CmmnModelConstants.CMMN11_NS; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ConditionExpressionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ConditionExpressionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b1171039feb30179e3cb010b88a15e1aa06a6aeb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ConditionExpressionTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ConditionExpressionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Expression.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CriterionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CriterionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c11e93d0c827efc639ab508aa41c325466dfae7f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/CriterionTest.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class CriterionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, true); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name"), + new AttributeAssumption("sentryRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DecisionParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DecisionParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b9b8252086bc039a88685f82720d24eb510b9f1c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DecisionParameterTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class DecisionParameterTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Parameter.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DecisionRefExpressionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DecisionRefExpressionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f8f6b9529795b0debc0b8469b4286010cea6adf8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DecisionRefExpressionTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class DecisionRefExpressionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Expression.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DecisionTaskTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DecisionTaskTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bc94449c1d3af3d83e2fb2b0a3568c8f59278ef1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DecisionTaskTest.java @@ -0,0 +1,52 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class DecisionTaskTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Task.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(ParameterMapping.class), + new ChildElementAssumption(DecisionRefExpression.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("decisionRef"), + new AttributeAssumption(CAMUNDA_NS, "resultVariable"), + new AttributeAssumption(CAMUNDA_NS, "decisionBinding"), + new AttributeAssumption(CAMUNDA_NS, "decisionVersion"), + new AttributeAssumption(CAMUNDA_NS, "mapDecisionResult"), + new AttributeAssumption(CAMUNDA_NS, "decisionTenantId") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DecisionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DecisionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0f0ffdb496fe15385a9890d2d848f778d0529f93 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DecisionTest.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class DecisionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(InputDecisionParameter.class), + new ChildElementAssumption(OutputDecisionParameter.class) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name"), + new AttributeAssumption("implementationType", false, false, "http://www.omg.org/spec/CMMN/DecisionType/Unspecified") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DefaultControlTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DefaultControlTest.java new file mode 100644 index 0000000000000000000000000000000000000000..474896e55449b609d4ae0bd2a9b2a34cc2811562 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DefaultControlTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class DefaultControlTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(PlanItemControl.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DefinitionsTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DefinitionsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..8687e4ad8c5660713ff8409b401d3d236ecd0bc0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DefinitionsTest.java @@ -0,0 +1,59 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class DefinitionsTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Import.class), + new ChildElementAssumption(CaseFileItemDefinition.class), + new ChildElementAssumption(Case.class), + new ChildElementAssumption(Process.class), + new ChildElementAssumption(Decision.class), + new ChildElementAssumption(ExtensionElements.class, 0, 1), + new ChildElementAssumption(Relationship.class), + new ChildElementAssumption(Artifact.class) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("id", true), + new AttributeAssumption("name"), + new AttributeAssumption("targetNamespace", false, true), + new AttributeAssumption("expressionLanguage", false, false, CmmnModelConstants.XPATH_NS), + new AttributeAssumption("exporter"), + new AttributeAssumption("exporterVersion"), + new AttributeAssumption("author") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DiscretionaryItemTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DiscretionaryItemTest.java new file mode 100644 index 0000000000000000000000000000000000000000..874bc495e92f67ccaa7f5caa064a4b8dc0cc0cfb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DiscretionaryItemTest.java @@ -0,0 +1,47 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class DiscretionaryItemTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(TableItem.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(ItemControl.class, 0, 1), + new ChildElementAssumption(EntryCriterion.class), + new ChildElementAssumption(ExitCriterion.class) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name"), + new AttributeAssumption("definitionRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DocumentationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DocumentationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..74b845be9905c882e401e15a8c0201bf125dcbba --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/DocumentationTest.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class DocumentationTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("id", true), + new AttributeAssumption("textFormat", false, false, "text/plain") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/EntryCriterionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/EntryCriterionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e983348075def415e6f8fa8579f4415efd2c3945 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/EntryCriterionTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class EntryCriterionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Criterion.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/EventListenerTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/EventListenerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c572ad236c8a72573b2bd3934be4b84145db5b2e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/EventListenerTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class EventListenerTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(PlanItemDefinition.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/EventTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/EventTest.java new file mode 100644 index 0000000000000000000000000000000000000000..fb9b3d7e6d08fa5f542f6c65f5893d1708b0636e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/EventTest.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class EventTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnModelConstants.CMMN10_NS, PlanItemDefinition.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ExitCriterionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ExitCriterionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..eb491194a2aeb4cce09ef0b56725a96775ea1f70 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ExitCriterionTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ExitCriterionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Criterion.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ExpressionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ExpressionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..07c927cd265d1be575845f2ef33b19a0a84082f2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ExpressionTest.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class ExpressionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(CmmnModelConstants.CMMN10_NS, Body.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("language", false, false, CmmnModelConstants.XPATH_NS) + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ExtensionElementsTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ExtensionElementsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..425c2f7db0ec6489dec723d05d4508bdd806bbe8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ExtensionElementsTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ExtensionElementsTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/HumanTaskTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/HumanTaskTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2d0fbf7a28ec682eacd8a07a56cbd991c4440f7c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/HumanTaskTest.java @@ -0,0 +1,54 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class HumanTaskTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Task.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(PlanningTable.class) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("performerRef"), + /** camunda extensions */ + new AttributeAssumption(CAMUNDA_NS, "assignee"), + new AttributeAssumption(CAMUNDA_NS, "candidateGroups"), + new AttributeAssumption(CAMUNDA_NS, "candidateUsers"), + new AttributeAssumption(CAMUNDA_NS, "dueDate"), + new AttributeAssumption(CAMUNDA_NS, "followUpDate"), + new AttributeAssumption(CAMUNDA_NS, "formKey"), + new AttributeAssumption(CAMUNDA_NS, "priority") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/IfPartTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/IfPartTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d13d2ca949febad7ef346e97fd7b1f35f328822f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/IfPartTest.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class IfPartTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(ConditionExpression.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("contextRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ImportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ImportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..aa0ec416a31ac5b4aea950176c5b854d3ea07e8d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ImportTest.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ImportTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("location", false, true), + new AttributeAssumption("namespace"), + new AttributeAssumption("importType", false, true) + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/InputCaseParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/InputCaseParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b8a5b26557b0f0f4fd4a1796746b453f6f0a3ed3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/InputCaseParameterTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class InputCaseParameterTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CaseParameter.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/InputDecisionParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/InputDecisionParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a4bbc512ce7e8c62ff7aae15ac606216a53cc7b7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/InputDecisionParameterTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class InputDecisionParameterTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DecisionParameter.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/InputProcessParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/InputProcessParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ead527acc47b573d2ea8506767b42ff9fb5982aa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/InputProcessParameterTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class InputProcessParameterTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(ProcessParameter.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/InputsCaseParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/InputsCaseParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0fac3b94d4afa450c6c1ac9b2723db971b574991 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/InputsCaseParameterTest.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class InputsCaseParameterTest extends CmmnModelElementInstanceTest { + + public String getDefaultNamespace() { + return CmmnModelConstants.CMMN10_NS; + } + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CaseParameter.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ItemControlTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ItemControlTest.java new file mode 100644 index 0000000000000000000000000000000000000000..cac09d8b84981cad02250f25609e1f2c3e964223 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ItemControlTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ItemControlTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(PlanItemControl.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ManualActivationRuleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ManualActivationRuleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5e9c1a2686b67e83fdf7a6a96d573e85d59fd503 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ManualActivationRuleTest.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ManualActivationRuleTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(ConditionExpression.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name"), + new AttributeAssumption("contextRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/MilestoneTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/MilestoneTest.java new file mode 100644 index 0000000000000000000000000000000000000000..891b9cd4d0686f859ecb2683d27b733e09295925 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/MilestoneTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class MilestoneTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(PlanItemDefinition.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OnPartTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OnPartTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ec5471d549a91992c9990eef2f6e2c5b1f0ac64e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OnPartTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class OnPartTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, true); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OutputCaseParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OutputCaseParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3ca764ffaccfb29b42b6aa7647efda4702dbd54f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OutputCaseParameterTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class OutputCaseParameterTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CaseParameter.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OutputDecisionParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OutputDecisionParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..662c23d8ee9d3d3e38a0b2f95ab6a49076cb872a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OutputDecisionParameterTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class OutputDecisionParameterTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DecisionParameter.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OutputProcessParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OutputProcessParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c2bd92e6d183a215b53377844b57dbd007c2c849 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OutputProcessParameterTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class OutputProcessParameterTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(ProcessParameter.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OutputsCaseParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OutputsCaseParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..97eea79a98f620ffa5f8e539c332172583b96c84 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/OutputsCaseParameterTest.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class OutputsCaseParameterTest extends CmmnModelElementInstanceTest { + + public String getDefaultNamespace() { + return CmmnModelConstants.CMMN10_NS; + } + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CaseParameter.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ParameterMappingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ParameterMappingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..74d7430875ffdfe82c536261dcb1f2f67f06569b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ParameterMappingTest.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ParameterMappingTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(TransformationExpression.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("sourceRef"), + new AttributeAssumption("targetRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..00a8c8744d540ad358fd01544b31e5ac85b2993a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ParameterTest.java @@ -0,0 +1,42 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ParameterTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, true); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanFragmentTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanFragmentTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7d024cda5a881eb9d81f9b5f5ad706ce52bde330 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanFragmentTest.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class PlanFragmentTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(PlanItemDefinition.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(PlanItem.class), + new ChildElementAssumption(Sentry.class) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemControlTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemControlTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3430faf0be13346cc8c5dc5b7e0bd57a768f3a0a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemControlTest.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class PlanItemControlTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(RepetitionRule.class, 0, 1), + new ChildElementAssumption(RequiredRule.class, 0, 1), + new ChildElementAssumption(ManualActivationRule.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemDefinitionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemDefinitionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..92eeab6ddb29c88caae2c6c69fc9105f77fbea60 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemDefinitionTest.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class PlanItemDefinitionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, true); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(DefaultControl.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemOnPartTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemOnPartTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bbcdc00e81dbfca3681d5d052f3cd9ab7a98180b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemOnPartTest.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class PlanItemOnPartTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(OnPart.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(PlanItemTransitionStandardEvent.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("sourceRef"), + new AttributeAssumption(CmmnModelConstants.CMMN10_NS, "sentryRef"), + new AttributeAssumption("exitCriterionRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemStartTriggerTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemStartTriggerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..075e45c33450378475107ddeec1e1fad69aeea51 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemStartTriggerTest.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class PlanItemStartTriggerTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(StartTrigger.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(PlanItemTransitionStandardEvent.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("sourceRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2d8988fa7a97b19db3aab10d34b6aefa34adaedd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemTest.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class PlanItemTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(ItemControl.class, 0, 1), + new ChildElementAssumption(EntryCriterion.class), + new ChildElementAssumption(ExitCriterion.class) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name"), + new AttributeAssumption("definitionRef"), + new AttributeAssumption(CmmnModelConstants.CMMN10_NS, "entryCriteriaRefs"), + new AttributeAssumption(CmmnModelConstants.CMMN10_NS, "exitCriteriaRefs") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemTransitionStandardEventTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemTransitionStandardEventTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3ad3f5c571f3b20a9e5d78b98f610c7a5960e0b4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PlanItemTransitionStandardEventTest.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstanceTest; + +/** + * @author Roman Smirnov + * + */ +public class PlanItemTransitionStandardEventTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + @Override + public Collection getChildElementAssumptions() { + return null; + } + + @Override + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ProcessParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ProcessParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e3547f53601e1dc75af81b74dd1f79cdaac98e33 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ProcessParameterTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ProcessParameterTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Parameter.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ProcessRefExpressionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ProcessRefExpressionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e895d63396218588d6b944519b9a8c9d810ae481 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ProcessRefExpressionTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ProcessRefExpressionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Expression.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ProcessTaskTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ProcessTaskTest.java new file mode 100644 index 0000000000000000000000000000000000000000..953abefae9ca4ceeddaf6d71282944a81d9dcdf3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ProcessTaskTest.java @@ -0,0 +1,50 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ProcessTaskTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Task.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(ParameterMapping.class), + new ChildElementAssumption(ProcessRefExpression.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("processRef"), + new AttributeAssumption(CAMUNDA_NS, "processBinding"), + new AttributeAssumption(CAMUNDA_NS, "processVersion"), + new AttributeAssumption(CAMUNDA_NS, "processTenantId") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ProcessTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ProcessTest.java new file mode 100644 index 0000000000000000000000000000000000000000..43d3504e4bb28047049c8f5b39b442ce4e51c9c6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/ProcessTest.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class ProcessTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(InputProcessParameter.class), + new ChildElementAssumption(OutputProcessParameter.class) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name"), + new AttributeAssumption("implementationType", false, false, "http://www.omg.org/spec/CMMN/ProcessType/Unspecified") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PropertyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PropertyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b6f2570d362fc9f45fc9ac26182f437da4c8be9b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/PropertyTest.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class PropertyTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name"), + new AttributeAssumption("type") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/RelationshipTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/RelationshipTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a3adcfb9d1d79e8559a256a1b9ae425d2cb104e5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/RelationshipTest.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + */ +public class RelationshipTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Source.class, 1), + new ChildElementAssumption(Target.class, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("type", false, true), + new AttributeAssumption("direction") + ); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/RepetitionRuleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/RepetitionRuleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4c358805fa36b8a793f08433c157b94e44e335a2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/RepetitionRuleTest.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class RepetitionRuleTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(ConditionExpression.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name"), + new AttributeAssumption("contextRef"), + new AttributeAssumption(CmmnModelConstants.CAMUNDA_NS, "repeatOnStandardEvent") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/RequiredRuleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/RequiredRuleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b5c335f6d822cf92b1b06b4d19432e8c74ca7738 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/RequiredRuleTest.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class RequiredRuleTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(ConditionExpression.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name"), + new AttributeAssumption("contextRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/RoleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/RoleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..912d8125cc80bb964b61087ae5adeb2b77b45d6e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/RoleTest.java @@ -0,0 +1,42 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class RoleTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/SentryTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/SentryTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5efee496976b4724ec4758b45de2453db0b29bef --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/SentryTest.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class SentryTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(OnPart.class), + new ChildElementAssumption(IfPart.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/SourceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/SourceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..87b15c83d4c4535ba2b0e686dc403e9ebb0e6973 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/SourceTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class SourceTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/StageTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/StageTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9b6cc7514851ecd1fa790b8e8f83a92599cdf075 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/StageTest.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class StageTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(PlanFragment.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(PlanningTable.class, 0 , 1), + new ChildElementAssumption(PlanItemDefinition.class), + new ChildElementAssumption(ExitCriterion.class) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("autoComplete", false, false, Boolean.FALSE), + new AttributeAssumption(CmmnModelConstants.CMMN10_NS, "exitCriteriaRefs") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/StartTriggerTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/StartTriggerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3014f4d7b633f1cfc9a9e735ef3f68a0110c721f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/StartTriggerTest.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class StartTriggerTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, true); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TableItemTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TableItemTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0647225743a049a71ad008cd6c49aaded2412427 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TableItemTest.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class TableItemTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnElement.class, true); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("applicabilityRuleRefs"), + new AttributeAssumption("authorizedRoleRefs") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TargetTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TargetTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1e9db5174d8e0d1671caf3071764d54bdae996d6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TargetTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class TargetTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TaskTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TaskTest.java new file mode 100644 index 0000000000000000000000000000000000000000..8420ac4bb82b8f27521b751a115608a719376fe1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TaskTest.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class TaskTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(PlanItemDefinition.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(CmmnModelConstants.CMMN10_NS, InputsCaseParameter.class), + new ChildElementAssumption(CmmnModelConstants.CMMN10_NS, OutputsCaseParameter.class), + new ChildElementAssumption(InputCaseParameter.class), + new ChildElementAssumption(OutputCaseParameter.class) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("isBlocking", false, false, Boolean.TRUE) + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TextAnnotationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TextAnnotationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bbe248043e9142a50f2a701a61f4c7ef3f419a64 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TextAnnotationTest.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class TextAnnotationTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Artifact.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Text.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("textFormat", false, false, "text/plain") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TimerEventListenerTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TimerEventListenerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1a1f4d7bb5fcf012a95557c79edd57d34f5a15bf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TimerEventListenerTest.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class TimerEventListenerTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(EventListener.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(TimerExpression.class, 0, 1), + new ChildElementAssumption(StartTrigger.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TimerEventTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TimerEventTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1a835dc0b64a15da3cd6e834932d8b17225d6111 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TimerEventTest.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class TimerEventTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnModelConstants.CMMN10_NS, Event.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(TimerExpression.class, 0, 1), + new ChildElementAssumption(StartTrigger.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TransformationExpressionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TransformationExpressionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..70a0daeb08cd0722689a61a2c498ba53373a75f7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/TransformationExpressionTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class TransformationExpressionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Expression.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/UserEventListenerTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/UserEventListenerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3440fa23c42971741e0f4c31b3e9664217d71fe0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/UserEventListenerTest.java @@ -0,0 +1,42 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +/** + * @author Roman Smirnov + * + */ +public class UserEventListenerTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(EventListener.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("authorizedRoleRefs") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/UserEventTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/UserEventTest.java new file mode 100644 index 0000000000000000000000000000000000000000..39bd9a7c000267efb1a088435e670a03e1dbaece --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/UserEventTest.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; + +/** + * @author Roman Smirnov + * + */ +public class UserEventTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CmmnModelConstants.CMMN10_NS, Event.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaCaseExecutionListenerTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaCaseExecutionListenerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..694cbd5851c9021588be23c2eb491fe9df4674c8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaCaseExecutionListenerTest.java @@ -0,0 +1,52 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstanceTest; + +/** + * @author Roman Smirnov + * + */ +public class CamundaCaseExecutionListenerTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CAMUNDA_NS, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(CAMUNDA_NS, CamundaField.class), + new ChildElementAssumption(CAMUNDA_NS, CamundaScript.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption(CAMUNDA_NS, "event"), + new AttributeAssumption(CAMUNDA_NS, "class"), + new AttributeAssumption(CAMUNDA_NS, "expression"), + new AttributeAssumption(CAMUNDA_NS, "delegateExpression") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaExpressionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaExpressionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..12ca8cd5ee10fb5c65024f430713dd96585648cc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaExpressionTest.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstanceTest; + +/** + * @author Roman Smirnov + * + */ +public class CamundaExpressionTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CAMUNDA_NS, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaFieldTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaFieldTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2717239cea624261d40953a835a1a5c2b371d545 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaFieldTest.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstanceTest; + +/** + * @author Roman Smirnov + * + */ +public class CamundaFieldTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CAMUNDA_NS, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(CAMUNDA_NS, CamundaExpression.class, 0, 1), + new ChildElementAssumption(CAMUNDA_NS, CamundaString.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption(CAMUNDA_NS, "name"), + new AttributeAssumption(CAMUNDA_NS, "expression"), + new AttributeAssumption(CAMUNDA_NS, "stringValue") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaInTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaInTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e0b4476c085f0fde0d506a6295ccca0e8f161ca8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaInTest.java @@ -0,0 +1,50 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstanceTest; + +/** + * @author Sebastian Menski + * @author Roman Smirnov + */ +public class CamundaInTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CAMUNDA_NS, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption(CAMUNDA_NS, "source"), + new AttributeAssumption(CAMUNDA_NS, "sourceExpression"), + new AttributeAssumption(CAMUNDA_NS, "variables"), + new AttributeAssumption(CAMUNDA_NS, "target"), + new AttributeAssumption(CAMUNDA_NS, "businessKey"), + new AttributeAssumption(CAMUNDA_NS, "local") + ); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaOutTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaOutTest.java new file mode 100644 index 0000000000000000000000000000000000000000..49bdb8635631b088ff7690850e5c851d07fc49b1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaOutTest.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstanceTest; + + +/** + * @author Sebastian Menski + * @author Roman Smirnov + */ +public class CamundaOutTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CAMUNDA_NS, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption(CAMUNDA_NS, "source"), + new AttributeAssumption(CAMUNDA_NS, "sourceExpression"), + new AttributeAssumption(CAMUNDA_NS, "variables"), + new AttributeAssumption(CAMUNDA_NS, "target") + ); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c4488d832e0051fe1f5f2a546eb45723608b8e06 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaScriptTest.java @@ -0,0 +1,47 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstanceTest; + +/** + * @author Roman Smirnov + * + */ +public class CamundaScriptTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CAMUNDA_NS, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption(CAMUNDA_NS, "scriptFormat"), + new AttributeAssumption(CAMUNDA_NS, "resource") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaStringTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaStringTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4470e53fbdb9281604040e6f1ceb35d9a1593f76 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaStringTest.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstanceTest; + +/** + * @author Roman Smirnov + * + */ +public class CamundaStringTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CAMUNDA_NS, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaTaskListenerTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaTaskListenerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..30cd9197b16ea81c08166b1f830aaf2398cb7e3e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaTaskListenerTest.java @@ -0,0 +1,52 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstanceTest; + +/** + * @author Roman Smirnov + * + */ +public class CamundaTaskListenerTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CAMUNDA_NS, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(CAMUNDA_NS, CamundaField.class), + new ChildElementAssumption(CAMUNDA_NS, CamundaScript.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption(CAMUNDA_NS, "event"), + new AttributeAssumption(CAMUNDA_NS, "class"), + new AttributeAssumption(CAMUNDA_NS, "expression"), + new AttributeAssumption(CAMUNDA_NS, "delegateExpression") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableListenerTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableListenerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..29580a027d8a16e32c9d1e9344fc89dfae458d82 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableListenerTest.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstanceTest; + +/** + * @author Thorben Lindhauer + */ +public class CamundaVariableListenerTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CAMUNDA_NS, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(CAMUNDA_NS, CamundaField.class), + new ChildElementAssumption(CAMUNDA_NS, CamundaScript.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption(CAMUNDA_NS, "event"), + new AttributeAssumption(CAMUNDA_NS, "class"), + new AttributeAssumption(CAMUNDA_NS, "expression"), + new AttributeAssumption(CAMUNDA_NS, "delegateExpression") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableOnPartTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableOnPartTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c4eaf2978d9684a9b148e9b61123cbfef9a21a44 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableOnPartTest.java @@ -0,0 +1,50 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CMMN11_NS; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstanceTest; + +/** + * + * @author Deivarayan Azhagappan + * + */ +public class CamundaVariableOnPartTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CAMUNDA_NS, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(CAMUNDA_NS, CamundaVariableTransitionEvent.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption(CAMUNDA_NS, "variableName") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableTransitionEventTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableTransitionEventTest.java new file mode 100644 index 0000000000000000000000000000000000000000..62988c1dfe0dadea1127da453ad2c492bdf04d13 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/instance/camunda/CamundaVariableTransitionEventTest.java @@ -0,0 +1,47 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.instance.camunda; + +import java.util.Collection; +import static org.camunda.bpm.model.cmmn.impl.CmmnModelConstants.CAMUNDA_NS; + +import org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstanceTest; + +/** + * + * @author Deivarayan Azhagappan + * + */ + +public class CamundaVariableTransitionEventTest extends CmmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(CAMUNDA_NS,false); + } + + @Override + public Collection getChildElementAssumptions() { + return null; + } + + @Override + public Collection getAttributesAssumptions() { + return null; + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/util/CmmnModelResource.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/util/CmmnModelResource.java new file mode 100644 index 0000000000000000000000000000000000000000..2bdbf0f3306a3e75e91e55e9f3536df00c0feb84 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/util/CmmnModelResource.java @@ -0,0 +1,32 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.util; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author Roman Smirnov + * + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface CmmnModelResource { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/util/GetCmmnModelElementTypeRule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/util/GetCmmnModelElementTypeRule.java new file mode 100644 index 0000000000000000000000000000000000000000..7fbe4080bf38394b661f3567ad37654c810e76b7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/util/GetCmmnModelElementTypeRule.java @@ -0,0 +1,65 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.util; + +import org.camunda.bpm.model.cmmn.Cmmn; +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.test.GetModelElementTypeRule; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; + +/** + * @author Sebastian Menski + * @author Roman Smirnov + */ +public class GetCmmnModelElementTypeRule extends TestWatcher implements GetModelElementTypeRule { + + private ModelInstance modelInstance; + private Model model; + private ModelElementType modelElementType; + + @Override + @SuppressWarnings("unchecked") + protected void starting(Description description) { + String className = description.getClassName(); + className = className.replaceAll("Test", ""); + Class instanceClass = null; + try { + instanceClass = (Class) Class.forName(className); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + modelInstance = Cmmn.createEmptyModel(); + model = modelInstance.getModel(); + modelElementType = model.getType(instanceClass); + } + + public ModelInstance getModelInstance() { + return modelInstance; + } + + public Model getModel() { + return model; + } + + public ModelElementType getModelElementType() { + return modelElementType; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/util/ParseCmmnModelRule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/util/ParseCmmnModelRule.java new file mode 100644 index 0000000000000000000000000000000000000000..e22d2f1e62faf3161c4f1c714348e3ff853f66c3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn/util/ParseCmmnModelRule.java @@ -0,0 +1,62 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn.util; + +import java.io.InputStream; + +import org.camunda.bpm.model.cmmn.Cmmn; +import org.camunda.bpm.model.cmmn.CmmnModelInstance; +import org.camunda.bpm.model.xml.impl.util.IoUtil; +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; + +/** + * @author Daniel Meyer + * @author Roman Smirnov + * + */ +public class ParseCmmnModelRule extends TestWatcher { + + protected CmmnModelInstance CmmnModelInstance; + + @Override + protected void starting(Description description) { + + if(description.getAnnotation(CmmnModelResource.class) != null) { + + Class testClass = description.getTestClass(); + String methodName = description.getMethodName(); + + String resourceFolderName = testClass.getName().replaceAll("\\.", "/"); + String cmmnResourceName = resourceFolderName + "." + methodName + ".cmmn"; + + InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream(cmmnResourceName); + try { + CmmnModelInstance = Cmmn.readModelFromStream(resourceAsStream); + } finally { + IoUtil.closeSilently(resourceAsStream); + } + + } + + } + + public CmmnModelInstance getCmmnModel() { + return CmmnModelInstance; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn10/Cmmn10Test.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn10/Cmmn10Test.java new file mode 100644 index 0000000000000000000000000000000000000000..11fd5be2bd3f68aa4e9038dc122099a6394047cc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/java/org/camunda/bpm/model/cmmn10/Cmmn10Test.java @@ -0,0 +1,226 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.cmmn10; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + +import java.util.Collection; + +import org.camunda.bpm.model.cmmn.Cmmn; +import org.camunda.bpm.model.cmmn.CmmnModelInstance; +import org.camunda.bpm.model.cmmn.impl.CmmnModelConstants; +import org.camunda.bpm.model.cmmn.instance.Case; +import org.camunda.bpm.model.cmmn.instance.CasePlanModel; +import org.camunda.bpm.model.cmmn.instance.CaseRole; +import org.camunda.bpm.model.cmmn.instance.CaseRoles; +import org.camunda.bpm.model.cmmn.instance.ConditionExpression; +import org.camunda.bpm.model.cmmn.instance.Documentation; +import org.camunda.bpm.model.cmmn.instance.EntryCriterion; +import org.camunda.bpm.model.cmmn.instance.Event; +import org.camunda.bpm.model.cmmn.instance.EventListener; +import org.camunda.bpm.model.cmmn.instance.ExitCriterion; +import org.camunda.bpm.model.cmmn.instance.HumanTask; +import org.camunda.bpm.model.cmmn.instance.IfPart; +import org.camunda.bpm.model.cmmn.instance.InputCaseParameter; +import org.camunda.bpm.model.cmmn.instance.InputsCaseParameter; +import org.camunda.bpm.model.cmmn.instance.OutputCaseParameter; +import org.camunda.bpm.model.cmmn.instance.OutputsCaseParameter; +import org.camunda.bpm.model.cmmn.instance.PlanItem; +import org.camunda.bpm.model.cmmn.instance.Sentry; +import org.camunda.bpm.model.cmmn.instance.TimerEvent; +import org.camunda.bpm.model.cmmn.instance.UserEvent; +import org.junit.Test; + +/** + * @author Roman Smirnov + * + */ +public class Cmmn10Test { + + @Test + public void shouldGetCasePlanModelExitCriterion() { + CmmnModelInstance modelInstance = getCmmnModelInstance(); + CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next(); + + Collection exitCriterias = casePlanModel.getExitCriterias(); + assertThat(exitCriterias).hasSize(1); + + Collection exitCriteria = casePlanModel.getExitCriteria(); + assertThat(exitCriteria).hasSize(1); + + Collection exitCriterions = casePlanModel.getExitCriterions(); + assertThat(exitCriterions).isEmpty(); + } + + @Test + public void shouldGetPlanItemExitCriterion() { + CmmnModelInstance modelInstance = getCmmnModelInstance(); + PlanItem planItem = modelInstance.getModelElementsByType(PlanItem.class).iterator().next(); + + Collection exitCriterias = planItem.getExitCriterias(); + assertThat(exitCriterias).hasSize(1); + + Collection exitCriteria = planItem.getExitCriteria(); + assertThat(exitCriteria).hasSize(1); + + Collection exitCriterions = planItem.getExitCriterions(); + assertThat(exitCriterions).isEmpty(); + } + + @Test + public void shouldGetPlanItemEntryCriterion() { + CmmnModelInstance modelInstance = getCmmnModelInstance(); + PlanItem planItem = modelInstance.getModelElementsByType(PlanItem.class).iterator().next(); + + Collection entryCriterias = planItem.getEntryCriterias(); + assertThat(entryCriterias).hasSize(1); + + Collection entryCriteria = planItem.getEntryCriteria(); + assertThat(entryCriteria).hasSize(1); + + Collection entryCriterions = planItem.getEntryCriterions(); + assertThat(entryCriterions).isEmpty(); + } + + @Test + public void shouldGetTaskInputsOutputs() { + CmmnModelInstance modelInstance = getCmmnModelInstance(); + HumanTask humanTask = modelInstance.getModelElementsByType(HumanTask.class).iterator().next(); + + Collection inputs = humanTask.getInputs(); + assertThat(inputs).hasSize(1); + + Collection inputParameters = humanTask.getInputParameters(); + assertThat(inputParameters).isEmpty(); + + Collection outputs = humanTask.getOutputs(); + assertThat(outputs).hasSize(1); + + Collection outputParameters = humanTask.getOutputParameters(); + assertThat(outputParameters).isEmpty(); + } + + @Test + public void shouldGetEvents() { + CmmnModelInstance modelInstance = getCmmnModelInstance(); + + Event event = modelInstance.getModelElementsByType(Event.class).iterator().next(); + assertThat(event).isNotNull(); + + UserEvent userEvent = modelInstance.getModelElementsByType(UserEvent.class).iterator().next(); + assertThat(userEvent).isNotNull(); + + TimerEvent timerEvent = modelInstance.getModelElementsByType(TimerEvent.class).iterator().next(); + assertThat(timerEvent).isNotNull(); + } + + @Test + public void shouldGetDescription() { + CmmnModelInstance modelInstance = getCmmnModelInstance(); + CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next(); + + String description = casePlanModel.getDescription(); + assertThat(description).isEqualTo("This is a description..."); + + Collection documentations = casePlanModel.getDocumentations(); + assertThat(documentations).isEmpty(); + } + + @Test + public void shouldGetMultipleIfPartConditions() { + CmmnModelInstance modelInstance = getCmmnModelInstance(); + Sentry sentry = modelInstance.getModelElementsByType(Sentry.class).iterator().next(); + + IfPart ifPart = sentry.getIfPart(); + assertThat(ifPart).isNotNull(); + + Collection conditions = ifPart.getConditions(); + assertThat(conditions).hasSize(2); + + ConditionExpression condition = ifPart.getCondition(); + assertThat(condition).isNotNull(); + } + + @Test + public void shouldGetCaseRoles() { + CmmnModelInstance modelInstance = getCmmnModelInstance(); + Case _case = modelInstance.getModelElementsByType(Case.class).iterator().next(); + + Collection roles = _case.getCaseRoles(); + assertThat(roles).hasSize(2); + + CaseRoles caseRole = _case.getRoles(); + assertThat(caseRole).isNull(); + } + + @Test + public void shouldGetExpressionTextContent() { + CmmnModelInstance modelInstance = getCmmnModelInstance(); + ConditionExpression expression = modelInstance.getModelElementsByType(ConditionExpression.class).iterator().next(); + + assertThat(expression.getBody()).isEqualTo("${value >= 100}"); + assertThat(expression.getText()).isEqualTo("${value >= 100}"); + } + + @Test + public void shouldNotAbleToAddNewElement() { + CmmnModelInstance modelInstance = getCmmnModelInstance(); + CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next(); + + HumanTask humanTask = modelInstance.newInstance(HumanTask.class); + casePlanModel.getPlanItemDefinitions().add(humanTask); + + try { + Cmmn.writeModelToStream(System.out, modelInstance); + fail("cannot save cmmn 1.0 model"); + } + catch (Exception e) { + // expected exception + } + } + + @Test + public void shouldReturnCmmn11Namespace() { + CmmnModelInstance modelInstance = getCmmnModelInstance(); + CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next(); + + assertThat(casePlanModel.getElementType().getTypeNamespace()).isEqualTo(CmmnModelConstants.CMMN11_NS); + } + + @Test + public void shouldNotAbleToAddCmmn10Element() { + CmmnModelInstance modelInstance = Cmmn.readModelFromStream(Cmmn10Test.class.getResourceAsStream("Cmmn11Test.cmmn")); + CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next(); + + Event event = modelInstance.newInstance(Event.class); + casePlanModel.getPlanItemDefinitions().add(event); + + try { + Cmmn.writeModelToStream(System.out, modelInstance); + fail("cannot save cmmn 1.1 model"); + } + catch (Exception e) { + // expected exception + } + } + + protected CmmnModelInstance getCmmnModelInstance() { + return Cmmn.readModelFromStream(Cmmn10Test.class.getResourceAsStream("Cmmn10Test.cmmn")); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/resources/org/camunda/bpm/model/cmmn/GenerateIdTest.cmmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/resources/org/camunda/bpm/model/cmmn/GenerateIdTest.cmmn new file mode 100644 index 0000000000000000000000000000000000000000..1bb67e6efc22d76f82445fda74b65a74af780815 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/resources/org/camunda/bpm/model/cmmn/GenerateIdTest.cmmn @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/resources/org/camunda/bpm/model/cmmn/SimpleTest.shouldGetElements.cmmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/resources/org/camunda/bpm/model/cmmn/SimpleTest.shouldGetElements.cmmn new file mode 100644 index 0000000000000000000000000000000000000000..931b48ae440eba76644229d03b0df338c4d1932f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/resources/org/camunda/bpm/model/cmmn/SimpleTest.shouldGetElements.cmmn @@ -0,0 +1,12 @@ + + + + + + + + + \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/resources/org/camunda/bpm/model/cmmn10/Cmmn10Test.cmmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/resources/org/camunda/bpm/model/cmmn10/Cmmn10Test.cmmn new file mode 100644 index 0000000000000000000000000000000000000000..07693c5462e2713b943cefe2c4e21eb30e79d118 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/resources/org/camunda/bpm/model/cmmn10/Cmmn10Test.cmmn @@ -0,0 +1,40 @@ + + + + + + + + + + + + complete + + + + ${value >= 100} + ${value >= 300} + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/resources/org/camunda/bpm/model/cmmn10/Cmmn11Test.cmmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/resources/org/camunda/bpm/model/cmmn10/Cmmn11Test.cmmn new file mode 100644 index 0000000000000000000000000000000000000000..1bb67e6efc22d76f82445fda74b65a74af780815 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/cmmn-model/src/test/resources/org/camunda/bpm/model/cmmn10/Cmmn11Test.cmmn @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/.clirr-jenkins-ignore.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/.clirr-jenkins-ignore.xml new file mode 100644 index 0000000000000000000000000000000000000000..a56634296b06545b74853bdc973f8a66055fdbf6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/.clirr-jenkins-ignore.xml @@ -0,0 +1,14 @@ + + + + ** + 5000 + ** + + + + ** + 7012 + * + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/README.md b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/README.md new file mode 100644 index 0000000000000000000000000000000000000000..7f4fb8583acdaded82e5562a2d66084b3ee68158 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/README.md @@ -0,0 +1,6 @@ +camunda-dmn-model +================== + +DMN 1.1 model API written in Java. + +Used DMN 1.1 Schema: [DMN11.xsd](src/main/resources/org/camunda/bpm/model/dmn/schema/DMN11.xsd) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..11cdfe702a5b9b22ff99f99d3346053e213b3515 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/pom.xml @@ -0,0 +1,146 @@ + + 4.0.0 + + + org.camunda.bpm.model + camunda-model-apis + ../ + 7.24.0-SNAPSHOT + + + camunda-dmn-model + jar + + + Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/ + + + Camunda Platform - DMN Model API + 2015 + + org.camunda.bpm.model.dmn + + !org.camunda.bpm.model.dmn.schema, + ${camunda.osgi.export.pkg};${camunda.osgi.version};-noimport:=true + + + + + + org.camunda.bpm.model + camunda-xml-model + + + + junit + junit + test + + + + org.assertj + assertj-core + test + + + + org.xmlunit + xmlunit-core + test + + + + org.camunda.bpm + camunda-bpm-archunit + ${project.version} + test + + + + + + + + org.apache.felix + maven-bundle-plugin + + + generate-sources + + cleanVersions + + + + bundle-manifest + process-classes + + manifest + + + + + + maven-surefire-plugin + + + org.camunda.bpm:camunda-bpm-archunit + + + + + + + + + + check-api-compatibility + + true + + + + + org.codehaus.mojo + clirr-maven-plugin + + ${camunda.version.old} + true + + org/camunda/bpm/model/dmn/impl/** + org/camunda/bpm/model/dmn/instance/Binding + org/camunda/bpm/model/dmn/instance/ParameterReference + + + + + all + verify + + check-no-fork + + + ${project.build.directory}/clirr-all.txt + false + false + + + + restrictive + verify + + check-no-fork + + + ${project.build.directory}/clirr-restrictive.txt + true + .clirr-jenkins-ignore.xml + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/AssociationDirection.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/AssociationDirection.java new file mode 100644 index 0000000000000000000000000000000000000000..09b3efc5124684eba3339fcdb4979b1cf8256ce8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/AssociationDirection.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +public enum AssociationDirection { + + None, + One, + Both + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/BuiltinAggregator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/BuiltinAggregator.java new file mode 100644 index 0000000000000000000000000000000000000000..0653b7e2809b33148ef8ad2975b9ad4640fbe8c6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/BuiltinAggregator.java @@ -0,0 +1,26 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +public enum BuiltinAggregator { + + SUM, + COUNT, + MIN, + MAX + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/DecisionTableOrientation.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/DecisionTableOrientation.java new file mode 100644 index 0000000000000000000000000000000000000000..d6dc2bd45649b4f6a1618c8675d39111a7281fa1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/DecisionTableOrientation.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +public enum DecisionTableOrientation { + + Rule_as_Row("Rule-as-Row"), + Rule_as_Column("Rule-as-Column"), + CrossTable; + + private final String name; + + DecisionTableOrientation() { + name = name(); + } + + DecisionTableOrientation(String name) { + this.name = name; + } + + public String toString() { + return name; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/Dmn.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/Dmn.java new file mode 100644 index 0000000000000000000000000000000000000000..2659b782729abc519eb89adc2204a99783fd7a55 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/Dmn.java @@ -0,0 +1,399 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN11_ALTERNATIVE_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN11_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN12_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN13_ALTERNATIVE_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN13_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN14_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN15_NS; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; + +import org.camunda.bpm.model.dmn.impl.DmnParser; +import org.camunda.bpm.model.dmn.impl.instance.AllowedAnswersImpl; +import org.camunda.bpm.model.dmn.impl.instance.AllowedValuesImpl; +import org.camunda.bpm.model.dmn.impl.instance.ArtifactImpl; +import org.camunda.bpm.model.dmn.impl.instance.AssociationImpl; +import org.camunda.bpm.model.dmn.impl.instance.AuthorityRequirementImpl; +import org.camunda.bpm.model.dmn.impl.instance.BindingImpl; +import org.camunda.bpm.model.dmn.impl.instance.BusinessContextElementImpl; +import org.camunda.bpm.model.dmn.impl.instance.BusinessKnowledgeModelImpl; +import org.camunda.bpm.model.dmn.impl.instance.ColumnImpl; +import org.camunda.bpm.model.dmn.impl.instance.ContextEntryImpl; +import org.camunda.bpm.model.dmn.impl.instance.ContextImpl; +import org.camunda.bpm.model.dmn.impl.instance.DecisionImpl; +import org.camunda.bpm.model.dmn.impl.instance.DecisionMadeReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.DecisionMakerReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.DecisionOwnedReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.DecisionOwnerReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.DecisionRuleImpl; +import org.camunda.bpm.model.dmn.impl.instance.DecisionServiceImpl; +import org.camunda.bpm.model.dmn.impl.instance.DecisionTableImpl; +import org.camunda.bpm.model.dmn.impl.instance.DefaultOutputEntryImpl; +import org.camunda.bpm.model.dmn.impl.instance.DefinitionsImpl; +import org.camunda.bpm.model.dmn.impl.instance.DescriptionImpl; +import org.camunda.bpm.model.dmn.impl.instance.DmnElementImpl; +import org.camunda.bpm.model.dmn.impl.instance.DmnElementReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.DrgElementImpl; +import org.camunda.bpm.model.dmn.impl.instance.DrgElementReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.ElementCollectionImpl; +import org.camunda.bpm.model.dmn.impl.instance.EncapsulatedDecisionReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.EncapsulatedLogicImpl; +import org.camunda.bpm.model.dmn.impl.instance.ExpressionImpl; +import org.camunda.bpm.model.dmn.impl.instance.ExtensionElementsImpl; +import org.camunda.bpm.model.dmn.impl.instance.FormalParameterImpl; +import org.camunda.bpm.model.dmn.impl.instance.FunctionDefinitionImpl; +import org.camunda.bpm.model.dmn.impl.instance.ImpactedPerformanceIndicatorReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.ImpactingDecisionReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.ImportImpl; +import org.camunda.bpm.model.dmn.impl.instance.ImportedElementImpl; +import org.camunda.bpm.model.dmn.impl.instance.ImportedValuesImpl; +import org.camunda.bpm.model.dmn.impl.instance.InformationItemImpl; +import org.camunda.bpm.model.dmn.impl.instance.InformationRequirementImpl; +import org.camunda.bpm.model.dmn.impl.instance.InputClauseImpl; +import org.camunda.bpm.model.dmn.impl.instance.InputDataImpl; +import org.camunda.bpm.model.dmn.impl.instance.InputDataReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.InputDecisionReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.InputEntryImpl; +import org.camunda.bpm.model.dmn.impl.instance.InputExpressionImpl; +import org.camunda.bpm.model.dmn.impl.instance.InputImpl; +import org.camunda.bpm.model.dmn.impl.instance.InputValuesImpl; +import org.camunda.bpm.model.dmn.impl.instance.InvocationImpl; +import org.camunda.bpm.model.dmn.impl.instance.ItemComponentImpl; +import org.camunda.bpm.model.dmn.impl.instance.ItemDefinitionImpl; +import org.camunda.bpm.model.dmn.impl.instance.ItemDefinitionReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.KnowledgeRequirementImpl; +import org.camunda.bpm.model.dmn.impl.instance.KnowledgeSourceImpl; +import org.camunda.bpm.model.dmn.impl.instance.ListImpl; +import org.camunda.bpm.model.dmn.impl.instance.LiteralExpressionImpl; +import org.camunda.bpm.model.dmn.impl.instance.NamedElementImpl; +import org.camunda.bpm.model.dmn.impl.instance.OrganizationUnitImpl; +import org.camunda.bpm.model.dmn.impl.instance.OutputClauseImpl; +import org.camunda.bpm.model.dmn.impl.instance.OutputDecisionReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.OutputEntryImpl; +import org.camunda.bpm.model.dmn.impl.instance.OutputImpl; +import org.camunda.bpm.model.dmn.impl.instance.OutputValuesImpl; +import org.camunda.bpm.model.dmn.impl.instance.OwnerReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.ParameterImpl; +import org.camunda.bpm.model.dmn.impl.instance.PerformanceIndicatorImpl; +import org.camunda.bpm.model.dmn.impl.instance.QuestionImpl; +import org.camunda.bpm.model.dmn.impl.instance.RelationImpl; +import org.camunda.bpm.model.dmn.impl.instance.RequiredAuthorityReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.RequiredDecisionReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.RequiredInputReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.RequiredKnowledgeReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.RowImpl; +import org.camunda.bpm.model.dmn.impl.instance.RuleImpl; +import org.camunda.bpm.model.dmn.impl.instance.SourceRefImpl; +import org.camunda.bpm.model.dmn.impl.instance.SupportedObjectiveReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.TargetRefImpl; +import org.camunda.bpm.model.dmn.impl.instance.TextAnnotationImpl; +import org.camunda.bpm.model.dmn.impl.instance.TextImpl; +import org.camunda.bpm.model.dmn.impl.instance.TypeImpl; +import org.camunda.bpm.model.dmn.impl.instance.TypeRefImpl; +import org.camunda.bpm.model.dmn.impl.instance.UnaryTestsImpl; +import org.camunda.bpm.model.dmn.impl.instance.UsingProcessReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.UsingTaskReferenceImpl; +import org.camunda.bpm.model.dmn.impl.instance.VariableImpl; +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.ModelParseException; +import org.camunda.bpm.model.xml.ModelValidationException; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.util.IoUtil; + +public class Dmn { + + /** the singleton instance of {@link Dmn}. If you want to customize the behavior of Dmn, + * replace this instance with an instance of a custom subclass of {@link Dmn}. */ + public static Dmn INSTANCE = new Dmn(); + + /** the parser used by the Dmn implementation. */ + private DmnParser dmnParser = new DmnParser(); + private final ModelBuilder dmnModelBuilder; + + /** The {@link Model} + */ + private Model dmnModel; + + /** + * Allows reading a {@link DmnModelInstance} from a File. + * + * @param file the {@link File} to read the {@link DmnModelInstance} from + * @return the model read + * @throws DmnModelException if the model cannot be read + */ + public static DmnModelInstance readModelFromFile(File file) { + return INSTANCE.doReadModelFromFile(file); + } + + /** + * Allows reading a {@link DmnModelInstance} from an {@link InputStream} + * + * @param stream the {@link InputStream} to read the {@link DmnModelInstance} from + * @return the model read + * @throws ModelParseException if the model cannot be read + */ + public static DmnModelInstance readModelFromStream(InputStream stream) { + return INSTANCE.doReadModelFromInputStream(stream); + } + + /** + * Allows writing a {@link DmnModelInstance} to a File. It will be + * validated before writing. + * + * @param file the {@link File} to write the {@link DmnModelInstance} to + * @param modelInstance the {@link DmnModelInstance} to write + * @throws DmnModelException if the model cannot be written + * @throws ModelValidationException if the model is not valid + */ + public static void writeModelToFile(File file, DmnModelInstance modelInstance) { + INSTANCE.doWriteModelToFile(file, modelInstance); + } + + /** + * Allows writing a {@link DmnModelInstance} to an {@link OutputStream}. It will be + * validated before writing. + * + * @param stream the {@link OutputStream} to write the {@link DmnModelInstance} to + * @param modelInstance the {@link DmnModelInstance} to write + * @throws ModelException if the model cannot be written + * @throws ModelValidationException if the model is not valid + */ + public static void writeModelToStream(OutputStream stream, DmnModelInstance modelInstance) { + INSTANCE.doWriteModelToOutputStream(stream, modelInstance); + } + + /** + * Allows the conversion of a {@link DmnModelInstance} to an {@link String}. It will + * be validated before conversion. + * + * @param modelInstance the model instance to convert + * @return the XML string representation of the model instance + */ + public static String convertToString(DmnModelInstance modelInstance) { + return INSTANCE.doConvertToString(modelInstance); + } + + /** + * Validate model DOM document + * + * @param modelInstance the {@link DmnModelInstance} to validate + * @throws ModelValidationException if the model is not valid + */ + public static void validateModel(DmnModelInstance modelInstance) { + INSTANCE.doValidateModel(modelInstance); + } + + /** + * Allows creating an new, empty {@link DmnModelInstance}. + * + * @return the empty model. + */ + public static DmnModelInstance createEmptyModel() { + return INSTANCE.doCreateEmptyModel(); + } + + /** + * Register known types of the Dmn model + */ + protected Dmn() { + dmnModelBuilder = ModelBuilder.createInstance("DMN Model"); + dmnModelBuilder.alternativeNamespace(DMN15_NS, DMN13_NS); + dmnModelBuilder.alternativeNamespace(DMN14_NS, DMN13_NS); + dmnModelBuilder.alternativeNamespace(DMN13_ALTERNATIVE_NS, DMN13_NS); + dmnModelBuilder.alternativeNamespace(DMN12_NS, DMN13_NS); + dmnModelBuilder.alternativeNamespace(DMN11_NS, DMN13_NS); + dmnModelBuilder.alternativeNamespace(DMN11_ALTERNATIVE_NS, DMN13_NS); + doRegisterTypes(dmnModelBuilder); + dmnModel = dmnModelBuilder.build(); + } + + protected DmnModelInstance doReadModelFromFile(File file) { + InputStream is = null; + try { + is = new FileInputStream(file); + return doReadModelFromInputStream(is); + + } catch (FileNotFoundException e) { + throw new DmnModelException("Cannot read model from file "+file+": file does not exist."); + + } finally { + IoUtil.closeSilently(is); + + } + } + + protected DmnModelInstance doReadModelFromInputStream(InputStream is) { + return dmnParser.parseModelFromStream(is); + } + + protected void doWriteModelToFile(File file, DmnModelInstance modelInstance) { + OutputStream os = null; + try { + os = new FileOutputStream(file); + doWriteModelToOutputStream(os, modelInstance); + } + catch (FileNotFoundException e) { + throw new DmnModelException("Cannot write model to file "+file+": file does not exist."); + } finally { + IoUtil.closeSilently(os); + } + } + + protected void doWriteModelToOutputStream(OutputStream os, DmnModelInstance modelInstance) { + // validate DOM document + doValidateModel(modelInstance); + // write XML + IoUtil.writeDocumentToOutputStream(modelInstance.getDocument(), os); + } + + protected String doConvertToString(DmnModelInstance modelInstance) { + // validate DOM document + doValidateModel(modelInstance); + // convert to XML string + return IoUtil.convertXmlDocumentToString(modelInstance.getDocument()); + } + + protected void doValidateModel(DmnModelInstance modelInstance) { + dmnParser.validateModel(modelInstance.getDocument()); + } + + protected DmnModelInstance doCreateEmptyModel() { + return dmnParser.getEmptyModel(); + } + + protected void doRegisterTypes(ModelBuilder modelBuilder) { + + AllowedAnswersImpl.registerType(modelBuilder); + AllowedValuesImpl.registerType(modelBuilder); + ArtifactImpl.registerType(modelBuilder); + AssociationImpl.registerType(modelBuilder); + AuthorityRequirementImpl.registerType(modelBuilder); + BindingImpl.registerType(modelBuilder); + BusinessContextElementImpl.registerType(modelBuilder); + BusinessKnowledgeModelImpl.registerType(modelBuilder); + ColumnImpl.registerType(modelBuilder); + ContextEntryImpl.registerType(modelBuilder); + ContextImpl.registerType(modelBuilder); + DecisionImpl.registerType(modelBuilder); + DecisionMadeReferenceImpl.registerType(modelBuilder); + DecisionMakerReferenceImpl.registerType(modelBuilder); + DecisionOwnedReferenceImpl.registerType(modelBuilder); + DecisionOwnerReferenceImpl.registerType(modelBuilder); + DecisionRuleImpl.registerType(modelBuilder); + DecisionServiceImpl.registerType(modelBuilder); + DecisionTableImpl.registerType(modelBuilder); + DefaultOutputEntryImpl.registerType(modelBuilder); + DefinitionsImpl.registerType(modelBuilder); + DescriptionImpl.registerType(modelBuilder); + DmnElementImpl.registerType(modelBuilder); + DmnElementReferenceImpl.registerType(modelBuilder); + DrgElementImpl.registerType(modelBuilder); + DrgElementReferenceImpl.registerType(modelBuilder); + ElementCollectionImpl.registerType(modelBuilder); + EncapsulatedDecisionReferenceImpl.registerType(modelBuilder); + EncapsulatedLogicImpl.registerType(modelBuilder); + ExpressionImpl.registerType(modelBuilder); + ExtensionElementsImpl.registerType(modelBuilder); + FormalParameterImpl.registerType(modelBuilder); + FunctionDefinitionImpl.registerType(modelBuilder); + ImpactedPerformanceIndicatorReferenceImpl.registerType(modelBuilder); + ImpactingDecisionReferenceImpl.registerType(modelBuilder); + ImportImpl.registerType(modelBuilder); + ImportedElementImpl.registerType(modelBuilder); + ImportedValuesImpl.registerType(modelBuilder); + InformationItemImpl.registerType(modelBuilder); + InformationRequirementImpl.registerType(modelBuilder); + InputImpl.registerType(modelBuilder); + InputClauseImpl.registerType(modelBuilder); + InputDataImpl.registerType(modelBuilder); + InputDataReferenceImpl.registerType(modelBuilder); + InputDecisionReferenceImpl.registerType(modelBuilder); + InputEntryImpl.registerType(modelBuilder); + InputExpressionImpl.registerType(modelBuilder); + InputValuesImpl.registerType(modelBuilder); + InvocationImpl.registerType(modelBuilder); + ItemComponentImpl.registerType(modelBuilder); + ItemDefinitionImpl.registerType(modelBuilder); + ItemDefinitionReferenceImpl.registerType(modelBuilder); + KnowledgeRequirementImpl.registerType(modelBuilder); + KnowledgeSourceImpl.registerType(modelBuilder); + ListImpl.registerType(modelBuilder); + LiteralExpressionImpl.registerType(modelBuilder); + ModelElementInstanceImpl.registerType(modelBuilder); + NamedElementImpl.registerType(modelBuilder); + OrganizationUnitImpl.registerType(modelBuilder); + OutputImpl.registerType(modelBuilder); + OutputClauseImpl.registerType(modelBuilder); + OutputDecisionReferenceImpl.registerType(modelBuilder); + OutputEntryImpl.registerType(modelBuilder); + OutputValuesImpl.registerType(modelBuilder); + OwnerReferenceImpl.registerType(modelBuilder); + ParameterImpl.registerType(modelBuilder); + PerformanceIndicatorImpl.registerType(modelBuilder); + QuestionImpl.registerType(modelBuilder); + RelationImpl.registerType(modelBuilder); + RequiredAuthorityReferenceImpl.registerType(modelBuilder); + RequiredDecisionReferenceImpl.registerType(modelBuilder); + RequiredInputReferenceImpl.registerType(modelBuilder); + RequiredKnowledgeReferenceImpl.registerType(modelBuilder); + RowImpl.registerType(modelBuilder); + RuleImpl.registerType(modelBuilder); + SourceRefImpl.registerType(modelBuilder); + SupportedObjectiveReferenceImpl.registerType(modelBuilder); + TargetRefImpl.registerType(modelBuilder); + TextImpl.registerType(modelBuilder); + TextAnnotationImpl.registerType(modelBuilder); + TypeImpl.registerType(modelBuilder); + TypeRefImpl.registerType(modelBuilder); + UnaryTestsImpl.registerType(modelBuilder); + UsingProcessReferenceImpl.registerType(modelBuilder); + UsingTaskReferenceImpl.registerType(modelBuilder); + VariableImpl.registerType(modelBuilder); + + /** camunda extensions */ + } + + /** + * @return the {@link Model} instance to use + */ + public Model getDmnModel() { + return dmnModel; + } + + public ModelBuilder getDmnModelBuilder() { + return dmnModelBuilder; + } + + /** + * @param dmnModel the cmmnModel to set + */ + public void setDmnModel(Model dmnModel) { + this.dmnModel = dmnModel; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/DmnModelException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/DmnModelException.java new file mode 100644 index 0000000000000000000000000000000000000000..9d2ee5b05c1791552693d3204859491d6f15d2df --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/DmnModelException.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import org.camunda.bpm.model.xml.ModelException; + +public class DmnModelException extends ModelException { + + private static final long serialVersionUID = 1L; + + public DmnModelException() { + } + + public DmnModelException(String message, Throwable cause) { + super(message, cause); + } + + public DmnModelException(String message) { + super(message); + } + + public DmnModelException(Throwable cause) { + super(cause); + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/DmnModelInstance.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/DmnModelInstance.java new file mode 100644 index 0000000000000000000000000000000000000000..dd3d06d72605fba06b2952b5f98aad567d4cd512 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/DmnModelInstance.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import org.camunda.bpm.model.dmn.instance.Definitions; +import org.camunda.bpm.model.xml.ModelInstance; + + +public interface DmnModelInstance extends ModelInstance { + + /** + * @return the {@link Definitions}, root element of the Dmn Model. + * */ + Definitions getDefinitions(); + + /** + * Set the Dmn Definitions Root element + * @param definitions the {@link Definitions} element to set + * */ + void setDefinitions(Definitions definitions); + + /** + * Copies the DMN model instance but not the model. So only the wrapped DOM document is cloned. + * Changes of the model are persistent between multiple model instances. + * + * @return the new DMN model instance + */ + DmnModelInstance clone(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/HitPolicy.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/HitPolicy.java new file mode 100644 index 0000000000000000000000000000000000000000..e7de4100979349a39197a2bf054d1536bb4aead4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/HitPolicy.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +public enum HitPolicy { + + UNIQUE, + FIRST, + PRIORITY, + ANY, + COLLECT, + RULE_ORDER("RULE ORDER"), + OUTPUT_ORDER("OUTPUT ORDER"); + + + private final String name; + + HitPolicy() { + name = name(); + } + + HitPolicy(String name) { + this.name = name; + } + + public String toString() { + return name; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/Query.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/Query.java new file mode 100644 index 0000000000000000000000000000000000000000..1a4246e728edb0f536fb8d16f68b110b76d1dfd4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/Query.java @@ -0,0 +1,36 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import java.util.List; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; + +public interface Query { + + List list(); + + int count(); + + Query filterByType(ModelElementType elementType); + + Query filterByType(Class elementClass); + + T singleResult(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/DmnModelConstants.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/DmnModelConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..471bd76da7d15e9dee40c384e13f49636281d42f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/DmnModelConstants.java @@ -0,0 +1,177 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl; + +public final class DmnModelConstants { + + /** The DMN 1.1 namespace */ + public static final String DMN11_NS = "http://www.omg.org/spec/DMN/20151101/dmn.xsd"; + public static final String DMN12_NS = "http://www.omg.org/spec/DMN/20180521/MODEL/"; + public static final String DMN13_NS = "https://www.omg.org/spec/DMN/20191111/MODEL/"; + public static final String DMN14_NS = "https://www.omg.org/spec/DMN/20211108/MODEL/"; + public static final String DMN15_NS = "https://www.omg.org/spec/DMN/20230324/MODEL/"; + public static final String LATEST_DMN_NS = DMN13_NS; + + /** + * The DMN 1.1 namespace URL release with Camunda 7.4.0 + */ + public static final String DMN11_ALTERNATIVE_NS = "http://www.omg.org/spec/DMN/20151101/dmn11.xsd"; + + /** + * The DMN 1.3 namespace URL release with Camunda 7.13.0 + */ + public static final String DMN13_ALTERNATIVE_NS = "https://www.omg.org/spec/DMN/20191111/DMN13.xsd"; + + /** The location of the DMN 1.1 XML schema. */ + public static final String DMN_11_SCHEMA_LOCATION = "org/camunda/bpm/model/dmn/schema/DMN11.xsd"; + public static final String DMN_12_SCHEMA_LOCATION = "org/camunda/bpm/model/dmn/schema/DMN12.xsd"; + public static final String DMN_13_SCHEMA_LOCATION = "org/camunda/bpm/model/dmn/schema/DMN13.xsd"; + public static final String DMN_14_SCHEMA_LOCATION = "org/camunda/bpm/model/dmn/schema/DMN14.xsd"; + public static final String DMN_15_SCHEMA_LOCATION = "org/camunda/bpm/model/dmn/schema/DMN15.xsd"; + /** + * The location of the DMN 1.1 XML schema released with Camunda 7.4.0 + */ + public static final String DMN_11_ALTERNATIVE_SCHEMA_LOCATION = "org/camunda/bpm/model/dmn/schema/DMN11_Alternative.xsd"; + + /** The FEEL namespace */ + public static final String FEEL_NS = "http://www.omg.org/spec/FEEL/20140401"; + public static final String FEEL12_NS = "http://www.omg.org/spec/DMN/20180521/FEEL/"; + public static final String FEEL13_NS = "https://www.omg.org/spec/DMN/20191111/FEEL/"; + public static final String FEEL14_NS = "https://www.omg.org/spec/DMN/20211108/FEEL/"; + public static final String FEEL15_NS = "https://www.omg.org/spec/DMN/20230324/FEEL/"; + + /** Camunda namespace */ + public static final String CAMUNDA_NS = "http://camunda.org/schema/1.0/dmn"; + + /** DMN element */ + + public static final String DMN_ELEMENT = "DMNElement"; + public static final String DMN_ELEMENT_ALLOWED_ANSWERS = "allowedAnswers"; + public static final String DMN_ELEMENT_ALLOWED_VALUE = "allowedValue"; + public static final String DMN_ELEMENT_ARTIFACT = "artifact"; + public static final String DMN_ELEMENT_ASSOCIATION = "association"; + public static final String DMN_ELEMENT_AUTHORITY_REQUIREMENT = "authorityRequirement"; + public static final String DMN_ELEMENT_BINDING = "binding"; + public static final String DMN_ELEMENT_BUSINESS_CONTEXT_ELEMENT = "businessContextElement"; + public static final String DMN_ELEMENT_BUSINESS_KNOWLEDGE_MODEL = "businessKnowledgeModel"; + public static final String DMN_ELEMENT_COLUMN = "column"; + public static final String DMN_ELEMENT_CONTEXT = "context"; + public static final String DMN_ELEMENT_CONTEXT_ENTRY = "contextEntry"; + public static final String DMN_ELEMENT_DECISION = "decision"; + public static final String DMN_ELEMENT_DECISION_MADE = "decisionMade"; + public static final String DMN_ELEMENT_DECISION_MAKER = "decisionMaker"; + public static final String DMN_ELEMENT_DECISION_OWNED = "decisionOwned"; + public static final String DMN_ELEMENT_DECISION_OWNER = "decisionOwner"; + public static final String DMN_ELEMENT_DECISION_RULE = "decisionRule"; + public static final String DMN_ELEMENT_DECISION_SERVICE = "decisionService"; + public static final String DMN_ELEMENT_DECISION_TABLE = "decisionTable"; + public static final String DMN_ELEMENT_DEFAULT_OUTPUT_ENTRY = "defaultOutputEntry"; + public static final String DMN_ELEMENT_DEFINITIONS = "definitions"; + public static final String DMN_ELEMENT_DESCRIPTION = "description"; + public static final String DMN_ELEMENT_DRG_ELEMENT = "drgElement"; + public static final String DMN_ELEMENT_DRG_ELEMENT_REFERENCE = "drgElement"; + public static final String DMN_ELEMENT_ELEMENT_COLLECTION = "elementCollection"; + public static final String DMN_ELEMENT_ENCAPSULATED_DECISION_REFERENCE = "encapsulatedDecision"; + public static final String DMN_ELEMENT_ENCAPSULATED_LOGIC = "encapsulatedLogic"; + public static final String DMN_ELEMENT_EXPRESSION = "expression"; + public static final String DMN_ELEMENT_EXTENSION_ELEMENTS = "extensionElements"; + public static final String DMN_ELEMENT_FORMAL_PARAMETER = "formalParameter"; + public static final String DMN_ELEMENT_FUNCTION_DEFINITION = "functionDefinition"; + public static final String DMN_ELEMENT_IMPACTED_PERFORMANCE_INDICATOR = "impactedPerformanceIndicator"; + public static final String DMN_ELEMENT_IMPACTING_DECISION = "impactingDecision"; + public static final String DMN_ELEMENT_IMPORT = "import"; + public static final String DMN_ELEMENT_IMPORTED_ELEMENT = "importedElement"; + public static final String DMN_ELEMENT_IMPORTED_VALUES = "importedValues"; + public static final String DMN_ELEMENT_INFORMATION_ITEM = "informationItem"; + public static final String DMN_ELEMENT_INFORMATION_REQUIREMENT = "informationRequirement"; + public static final String DMN_ELEMENT_INPUT = "input"; + public static final String DMN_ELEMENT_INPUT_CLAUSE = "inputClause"; + public static final String DMN_ELEMENT_INPUT_DATA = "inputData"; + public static final String DMN_ELEMENT_INPUT_DATA_REFERENCE = "inputData"; + public static final String DMN_ELEMENT_INPUT_DECISION_REFERENCE = "inputDecision"; + public static final String DMN_ELEMENT_INPUT_ENTRY = "inputEntry"; + public static final String DMN_ELEMENT_INPUT_EXPRESSION = "inputExpression"; + public static final String DMN_ELEMENT_INPUT_VALUES = "inputValues"; + public static final String DMN_ELEMENT_INVOCATION = "invocation"; + public static final String DMN_ELEMENT_ITEM_COMPONENT = "itemComponent"; + public static final String DMN_ELEMENT_ITEM_DEFINITION = "itemDefinition"; + public static final String DMN_ELEMENT_ITEM_DEFINITION_REFERENCE = "itemDefinition"; + public static final String DMN_ELEMENT_KNOWLEDGE_REQUIREMENT = "knowledgeRequirement"; + public static final String DMN_ELEMENT_KNOWLEDGE_SOURCE = "knowledgeSource"; + public static final String DMN_ELEMENT_LIST = "list"; + public static final String DMN_ELEMENT_LITERAL_EXPRESSION = "literalExpression"; + public static final String DMN_ELEMENT_NAMED_ELEMENT = "namedElement"; + public static final String DMN_ELEMENT_ORGANIZATION_UNIT = "organizationUnit"; + public static final String DMN_ELEMENT_OUTPUT = "output"; + public static final String DMN_ELEMENT_OUTPUT_CLAUSE = "outputClause"; + public static final String DMN_ELEMENT_OUTPUT_DECISION_REFERENCE = "outputDecision"; + public static final String DMN_ELEMENT_OUTPUT_ENTRY = "outputEntry"; + public static final String DMN_ELEMENT_OUTPUT_VALUES = "outputValues"; + public static final String DMN_ELEMENT_OWNER = "owner"; + public static final String DMN_ELEMENT_PARAMETER = "parameter"; + public static final String DMN_ELEMENT_PERFORMANCE_INDICATOR = "performanceIndicator"; + public static final String DMN_ELEMENT_QUESTION = "question"; + public static final String DMN_ELEMENT_REFERENCE = "DMNElementReference"; + public static final String DMN_ELEMENT_RELATION = "relation"; + public static final String DMN_ELEMENT_REQUIRED_AUTHORITY = "requiredAuthority"; + public static final String DMN_ELEMENT_REQUIRED_DECISION = "requiredDecision"; + public static final String DMN_ELEMENT_REQUIRED_INPUT = "requiredInput"; + public static final String DMN_ELEMENT_REQUIRED_KNOWLEDGE = "requiredKnowledge"; + public static final String DMN_ELEMENT_ROW = "row"; + public static final String DMN_ELEMENT_RULE = "rule"; + public static final String DMN_ELEMENT_SOURCE_REF = "sourceRef"; + public static final String DMN_ELEMENT_SUPPORTED_OBJECT = "supportedObjective"; + public static final String DMN_ELEMENT_TARGET_REF = "targetRef"; + public static final String DMN_ELEMENT_TEXT = "text"; + public static final String DMN_ELEMENT_TEXT_ANNOTATION = "textAnnotation"; + public static final String DMN_ELEMENT_TYPE = "type"; + public static final String DMN_ELEMENT_TYPE_REF = "typeRef"; + public static final String DMN_ELEMENT_UNARY_TESTS = "unaryTests"; + public static final String DMN_ELEMENT_USING_PROCESS = "usingProcess"; + public static final String DMN_ELEMENT_USING_TASK = "usingTask"; + public static final String DMN_ELEMENT_VARIABLE = "variable"; + + /** DMN attributes */ + + public static final String DMN_ATTRIBUTE_AGGREGATION = "aggregation"; + public static final String DMN_ATTRIBUTE_ASSOCIATION_DIRECTION = "associationDirection"; + public static final String DMN_ATTRIBUTE_EXPRESSION_LANGUAGE = "expressionLanguage"; + public static final String DMN_ATTRIBUTE_EXPORTER = "exporter"; + public static final String DMN_ATTRIBUTE_EXPORTER_VERSION = "exporterVersion"; + public static final String DMN_ATTRIBUTE_HIT_POLICY = "hitPolicy"; + public static final String DMN_ATTRIBUTE_HREF = "href"; + public static final String DMN_ATTRIBUTE_ID = "id"; + public static final String DMN_ATTRIBUTE_IMPORT_TYPE = "importType"; + public static final String DMN_ATTRIBUTE_IS_COLLECTION = "isCollection"; + public static final String DMN_ATTRIBUTE_LABEL = "label"; + public static final String DMN_ATTRIBUTE_LOCATION_URI = "locationURI"; + public static final String DMN_ATTRIBUTE_NAME = "name"; + public static final String DMN_ATTRIBUTE_NAMESPACE = "namespace"; + public static final String DMN_ATTRIBUTE_OUTPUT_LABEL = "outputLabel"; + public static final String DMN_ATTRIBUTE_PREFERRED_ORIENTATION = "preferredOrientation"; + public static final String DMN_ATTRIBUTE_TEXT_FORMAT = "textFormat"; + public static final String DMN_ATTRIBUTE_TYPE_LANGUAGE = "typeLanguage"; + public static final String DMN_ATTRIBUTE_TYPE_REF = "typeRef"; + public static final String DMN_ATTRIBUTE_URI = "URI"; + + /** camunda extensions */ + + public static final String CAMUNDA_ATTRIBUTE_INPUT_VARIABLE = "inputVariable"; + public static final String CAMUNDA_ATTRIBUTE_HISTORY_TIME_TO_LIVE = "historyTimeToLive"; + public static final String CAMUNDA_ATTRIBUTE_VERSION_TAG = "versionTag"; + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/DmnModelInstanceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/DmnModelInstanceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4dce5896f0ddeffaf2d7bec565ccc4160f6b240f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/DmnModelInstanceImpl.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl; + +import org.camunda.bpm.model.dmn.DmnModelInstance; +import org.camunda.bpm.model.dmn.instance.Definitions; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.ModelImpl; +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.instance.DomDocument; + + +public class DmnModelInstanceImpl extends ModelInstanceImpl implements DmnModelInstance { + + public DmnModelInstanceImpl(ModelImpl model, ModelBuilder modelBuilder, DomDocument document) { + super(model, modelBuilder, document); + } + + public Definitions getDefinitions() { + return (Definitions) getDocumentElement(); + } + + public void setDefinitions(Definitions definitions) { + setDocumentElement(definitions); + } + + @Override + public DmnModelInstance clone() { + return new DmnModelInstanceImpl(model, modelBuilder, document.clone()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/DmnParser.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/DmnParser.java new file mode 100644 index 0000000000000000000000000000000000000000..62b146c956ed4f09180a5576e17113806fef9637 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/DmnParser.java @@ -0,0 +1,95 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN11_ALTERNATIVE_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN11_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN12_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN13_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN14_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN15_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_11_ALTERNATIVE_SCHEMA_LOCATION; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_11_SCHEMA_LOCATION; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_12_SCHEMA_LOCATION; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_13_SCHEMA_LOCATION; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_14_SCHEMA_LOCATION; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_15_SCHEMA_LOCATION; + +import java.io.InputStream; + +import org.camunda.bpm.model.dmn.Dmn; +import org.camunda.bpm.model.dmn.DmnModelException; +import org.camunda.bpm.model.xml.ModelParseException; +import org.camunda.bpm.model.xml.impl.ModelImpl; +import org.camunda.bpm.model.xml.impl.parser.AbstractModelParser; +import org.camunda.bpm.model.xml.impl.util.ReflectUtil; +import org.camunda.bpm.model.xml.instance.DomDocument; + +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.validation.SchemaFactory; + +public class DmnParser extends AbstractModelParser { + + private static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; + private static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; + + private static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; + + public DmnParser() { + this.schemaFactory = SchemaFactory.newInstance(W3C_XML_SCHEMA); + addSchema(DMN15_NS, createSchema(DMN_15_SCHEMA_LOCATION, DmnParser.class.getClassLoader())); + addSchema(DMN14_NS, createSchema(DMN_14_SCHEMA_LOCATION, DmnParser.class.getClassLoader())); + addSchema(DMN13_NS, createSchema(DMN_13_SCHEMA_LOCATION, DmnParser.class.getClassLoader())); + addSchema(DMN12_NS, createSchema(DMN_12_SCHEMA_LOCATION, DmnParser.class.getClassLoader())); + addSchema(DMN11_NS, createSchema(DMN_11_SCHEMA_LOCATION, DmnParser.class.getClassLoader())); + addSchema(DMN11_ALTERNATIVE_NS, createSchema(DMN_11_ALTERNATIVE_SCHEMA_LOCATION, DmnParser.class.getClassLoader())); + } + + @Override + protected void configureFactory(DocumentBuilderFactory dbf) { + dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); + dbf.setAttribute(JAXP_SCHEMA_SOURCE, new String[] { + ReflectUtil.getResource(DMN_15_SCHEMA_LOCATION, DmnParser.class.getClassLoader()).toString(), + ReflectUtil.getResource(DMN_14_SCHEMA_LOCATION, DmnParser.class.getClassLoader()).toString(), + ReflectUtil.getResource(DMN_13_SCHEMA_LOCATION, DmnParser.class.getClassLoader()).toString(), + ReflectUtil.getResource(DMN_12_SCHEMA_LOCATION, DmnParser.class.getClassLoader()).toString(), + ReflectUtil.getResource(DMN_11_SCHEMA_LOCATION, DmnParser.class.getClassLoader()).toString(), + ReflectUtil.getResource(DMN_11_ALTERNATIVE_SCHEMA_LOCATION, DmnParser.class.getClassLoader()).toString() + }); + super.configureFactory(dbf); + } + + @Override + protected DmnModelInstanceImpl createModelInstance(DomDocument document) { + return new DmnModelInstanceImpl((ModelImpl) Dmn.INSTANCE.getDmnModel(), Dmn.INSTANCE.getDmnModelBuilder(), document); + } + + @Override + public DmnModelInstanceImpl parseModelFromStream(InputStream inputStream) { + try { + return (DmnModelInstanceImpl) super.parseModelFromStream(inputStream); + } + catch (ModelParseException e) { + throw new DmnModelException("Unable to parse model", e); + } + } + + @Override + public DmnModelInstanceImpl getEmptyModel() { + return (DmnModelInstanceImpl) super.getEmptyModel(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/QueryImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/QueryImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9b181276ecde9a61470fce91c9e12ad5e4eb285b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/QueryImpl.java @@ -0,0 +1,69 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.camunda.bpm.model.dmn.DmnModelException; +import org.camunda.bpm.model.dmn.Query; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; + +public class QueryImpl implements Query { + + private final Collection collection; + + public QueryImpl(Collection collection) { + this.collection = collection; + } + + public List list() { + return new ArrayList(collection); + } + + public int count() { + return collection.size(); + } + + @SuppressWarnings("unchecked") + public Query filterByType(ModelElementType elementType) { + Class elementClass = (Class) elementType.getInstanceType(); + return filterByType(elementClass); + } + + @SuppressWarnings("unchecked") + public Query filterByType(Class elementClass) { + List filtered = new ArrayList(); + for (T instance : collection) { + if (elementClass.isAssignableFrom(instance.getClass())) { + filtered.add((V) instance); + } + } + return new QueryImpl(filtered); + } + + public T singleResult() { + if (collection.size() == 1) { + return collection.iterator().next(); + } + else { + throw new DmnModelException("Collection expected to have <1> entry but has <" + collection.size() + ">"); + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/AllowedAnswersImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/AllowedAnswersImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..43896d4d6b1df23252469029a7e6ecdf50a63f0b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/AllowedAnswersImpl.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_ALLOWED_ANSWERS; + +import org.camunda.bpm.model.dmn.instance.AllowedAnswers; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class AllowedAnswersImpl extends DmnModelElementInstanceImpl implements AllowedAnswers { + + public AllowedAnswersImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(AllowedAnswers.class, DMN_ELEMENT_ALLOWED_ANSWERS) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public AllowedAnswers newInstance(ModelTypeInstanceContext instanceContext) { + return new AllowedAnswersImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/AllowedValuesImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/AllowedValuesImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..a5b80c1c812f7631cb044d0844a3cf16c43f3907 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/AllowedValuesImpl.java @@ -0,0 +1,47 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_ALLOWED_VALUE; + +import org.camunda.bpm.model.dmn.instance.AllowedValues; +import org.camunda.bpm.model.dmn.instance.LiteralExpression; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class AllowedValuesImpl extends UnaryTestsImpl implements AllowedValues { + + public AllowedValuesImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(AllowedValues.class, DMN_ELEMENT_ALLOWED_VALUE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(LiteralExpression.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public AllowedValues newInstance(ModelTypeInstanceContext instanceContext) { + return new AllowedValuesImpl(instanceContext); + } + }); + + typeBuilder.build(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ArtifactImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ArtifactImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..37d372fc635c7d8b08a2eea411e3e13e9ebd5bed --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ArtifactImpl.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_ARTIFACT; + +import org.camunda.bpm.model.dmn.instance.Artifact; +import org.camunda.bpm.model.dmn.instance.DmnElement; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; + +public abstract class ArtifactImpl extends DmnElementImpl implements Artifact { + + public ArtifactImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Artifact.class, DMN_ELEMENT_ARTIFACT) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElement.class) + .abstractType(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/AssociationImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/AssociationImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..3a683a22a6aca1c01e73bd93286824414c2da0ab --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/AssociationImpl.java @@ -0,0 +1,101 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_ASSOCIATION_DIRECTION; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_ASSOCIATION; + +import org.camunda.bpm.model.dmn.AssociationDirection; +import org.camunda.bpm.model.dmn.instance.Artifact; +import org.camunda.bpm.model.dmn.instance.Association; +import org.camunda.bpm.model.dmn.instance.DmnElement; +import org.camunda.bpm.model.dmn.instance.SourceRef; +import org.camunda.bpm.model.dmn.instance.TargetRef; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReference; + +public class AssociationImpl extends ArtifactImpl implements Association { + + protected static Attribute associationDirectionAttribute; + + protected static ElementReference sourceRef; + protected static ElementReference targetRef; + + public AssociationImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public AssociationDirection getAssociationDirection() { + return associationDirectionAttribute.getValue(this); + } + + public void setAssociationDirection(AssociationDirection associationDirection) { + associationDirectionAttribute.setValue(this, associationDirection); + } + + public DmnElement getSource() { + return sourceRef.getReferenceTargetElement(this); + } + + public void setSource(DmnElement source) { + sourceRef.setReferenceTargetElement(this, source); + } + + public DmnElement getTarget() { + return targetRef.getReferenceTargetElement(this); + } + + public void setTarget(DmnElement target) { + targetRef.setReferenceTargetElement(this, target); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Association.class, DMN_ELEMENT_ASSOCIATION) + .namespaceUri(LATEST_DMN_NS) + .extendsType(Artifact.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Association newInstance(ModelTypeInstanceContext instanceContext) { + return new AssociationImpl(instanceContext); + } + }); + + associationDirectionAttribute = typeBuilder.enumAttribute(DMN_ATTRIBUTE_ASSOCIATION_DIRECTION, AssociationDirection.class) + .defaultValue(AssociationDirection.None) + .build(); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + sourceRef = sequenceBuilder.element(SourceRef.class) + .required() + .uriElementReference(DmnElement.class) + .build(); + + targetRef = sequenceBuilder.element(TargetRef.class) + .required() + .uriElementReference(DmnElement.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/AuthorityRequirementImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/AuthorityRequirementImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..19003cf494b2cdbd71bcc39947936147dc034d64 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/AuthorityRequirementImpl.java @@ -0,0 +1,96 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_AUTHORITY_REQUIREMENT; + +import org.camunda.bpm.model.dmn.instance.AuthorityRequirement; +import org.camunda.bpm.model.dmn.instance.Decision; +import org.camunda.bpm.model.dmn.instance.InputData; +import org.camunda.bpm.model.dmn.instance.KnowledgeSource; +import org.camunda.bpm.model.dmn.instance.RequiredAuthorityReference; +import org.camunda.bpm.model.dmn.instance.RequiredDecisionReference; +import org.camunda.bpm.model.dmn.instance.RequiredInputReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReference; + +public class AuthorityRequirementImpl extends DmnModelElementInstanceImpl implements AuthorityRequirement { + + protected static ElementReference requiredDecisionRef; + protected static ElementReference requiredInputRef; + protected static ElementReference requiredAuthorityRef; + + public AuthorityRequirementImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Decision getRequiredDecision() { + return requiredDecisionRef.getReferenceTargetElement(this); + } + + public void setRequiredDecision(Decision requiredDecision) { + requiredDecisionRef.setReferenceTargetElement(this, requiredDecision); + } + + public InputData getRequiredInput() { + return requiredInputRef.getReferenceTargetElement(this); + } + + public void setRequiredInput(InputData requiredInput) { + requiredInputRef.setReferenceTargetElement(this, requiredInput); + } + + public KnowledgeSource getRequiredAuthority() { + return requiredAuthorityRef.getReferenceTargetElement(this); + } + + public void setRequiredAuthority(KnowledgeSource requiredAuthority) { + requiredAuthorityRef.setReferenceTargetElement(this, requiredAuthority); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(AuthorityRequirement.class, DMN_ELEMENT_AUTHORITY_REQUIREMENT) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public AuthorityRequirement newInstance(ModelTypeInstanceContext instanceContext) { + return new AuthorityRequirementImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + requiredDecisionRef = sequenceBuilder.element(RequiredDecisionReference.class) + .uriElementReference(Decision.class) + .build(); + + requiredInputRef = sequenceBuilder.element(RequiredInputReference.class) + .uriElementReference(InputData.class) + .build(); + + requiredAuthorityRef = sequenceBuilder.element(RequiredAuthorityReference.class) + .uriElementReference(KnowledgeSource.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/BindingImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/BindingImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..2ca8260876e527e5842b3826f1960d9fcf7ea5ce --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/BindingImpl.java @@ -0,0 +1,76 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_BINDING; + +import org.camunda.bpm.model.dmn.instance.*; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class BindingImpl extends DmnModelElementInstanceImpl implements Binding { + + protected static ChildElement parameterChild; + protected static ChildElement expressionChild; + + public BindingImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Parameter getParameter() { + return parameterChild.getChild(this); + } + + public void setParameter(Parameter parameter) { + parameterChild.setChild(this, parameter); + } + + public Expression getExpression() { + return expressionChild.getChild(this); + } + + public void setExpression(Expression expression) { + expressionChild.setChild(this, expression); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Binding.class, DMN_ELEMENT_BINDING) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public Binding newInstance(ModelTypeInstanceContext instanceContext) { + return new BindingImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + parameterChild = sequenceBuilder.element(Parameter.class) + .required() + .build(); + + expressionChild = sequenceBuilder.element(Expression.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/BusinessContextElementImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/BusinessContextElementImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..932e400cb952de75deeccb3d2115761043f2153a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/BusinessContextElementImpl.java @@ -0,0 +1,58 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_URI; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_BUSINESS_CONTEXT_ELEMENT; + +import org.camunda.bpm.model.dmn.instance.BusinessContextElement; +import org.camunda.bpm.model.dmn.instance.NamedElement; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.attribute.Attribute; + +public abstract class BusinessContextElementImpl extends NamedElementImpl implements BusinessContextElement { + + protected static Attribute uriAttribute; + + public BusinessContextElementImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getUri() { + return uriAttribute.getValue(this); + } + + public void setUri(String uri) { + uriAttribute.setValue(this, uri); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(BusinessContextElement.class, DMN_ELEMENT_BUSINESS_CONTEXT_ELEMENT) + .namespaceUri(LATEST_DMN_NS) + .extendsType(NamedElement.class) + .abstractType(); + + uriAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_URI) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/BusinessKnowledgeModelImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/BusinessKnowledgeModelImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c9c6be985b387b75a00f332bb7afad0509bc6a58 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/BusinessKnowledgeModelImpl.java @@ -0,0 +1,100 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_BUSINESS_KNOWLEDGE_MODEL; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.AuthorityRequirement; +import org.camunda.bpm.model.dmn.instance.BusinessKnowledgeModel; +import org.camunda.bpm.model.dmn.instance.DrgElement; +import org.camunda.bpm.model.dmn.instance.EncapsulatedLogic; +import org.camunda.bpm.model.dmn.instance.KnowledgeRequirement; +import org.camunda.bpm.model.dmn.instance.Variable; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class BusinessKnowledgeModelImpl extends DrgElementImpl implements BusinessKnowledgeModel { + + protected static ChildElement encapsulatedLogicChild; + protected static ChildElement variableChild; + protected static ChildElementCollection knowledgeRequirementCollection; + protected static ChildElementCollection authorityRequirementCollection; + + public BusinessKnowledgeModelImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public EncapsulatedLogic getEncapsulatedLogic() { + return encapsulatedLogicChild.getChild(this); + } + + public void setEncapsulatedLogic(EncapsulatedLogic encapsulatedLogic) { + encapsulatedLogicChild.setChild(this, encapsulatedLogic); + } + + public Variable getVariable() { + return variableChild.getChild(this); + } + + public void setVariable(Variable variable) { + variableChild.setChild(this, variable); + } + + public Collection getKnowledgeRequirement() { + return knowledgeRequirementCollection.get(this); + } + + public Collection getAuthorityRequirement() { + return authorityRequirementCollection.get(this); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(BusinessKnowledgeModel.class, DMN_ELEMENT_BUSINESS_KNOWLEDGE_MODEL) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DrgElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public BusinessKnowledgeModel newInstance(ModelTypeInstanceContext instanceContext) { + return new BusinessKnowledgeModelImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + encapsulatedLogicChild = sequenceBuilder.element(EncapsulatedLogic.class) + .build(); + + variableChild = sequenceBuilder.element(Variable.class) + .build(); + + knowledgeRequirementCollection = sequenceBuilder.elementCollection(KnowledgeRequirement.class) + .build(); + + authorityRequirementCollection = sequenceBuilder.elementCollection(AuthorityRequirement.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ColumnImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ColumnImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..cd42b80fd6fddcb8c79523588b4d990ca5c7b33b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ColumnImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_COLUMN; + +import org.camunda.bpm.model.dmn.instance.Column; +import org.camunda.bpm.model.dmn.instance.InformationItem; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class ColumnImpl extends InformationItemImpl implements Column { + + public ColumnImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Column.class, DMN_ELEMENT_COLUMN) + .namespaceUri(LATEST_DMN_NS) + .extendsType(InformationItem.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Column newInstance(ModelTypeInstanceContext instanceContext) { + return new ColumnImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ContextEntryImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ContextEntryImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c54031d8e44eb9d2e56d83f2dd96439ac129d9cb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ContextEntryImpl.java @@ -0,0 +1,78 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_CONTEXT_ENTRY; + +import org.camunda.bpm.model.dmn.instance.ContextEntry; +import org.camunda.bpm.model.dmn.instance.Expression; +import org.camunda.bpm.model.dmn.instance.Variable; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class ContextEntryImpl extends DmnModelElementInstanceImpl implements ContextEntry { + + protected static ChildElement variableChild; + protected static ChildElement expressionChild; + + public ContextEntryImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Variable getVariable() { + return variableChild.getChild(this); + } + + public void setVariable(Variable variable) { + variableChild.setChild(this, variable); + } + + public Expression getExpression() { + return expressionChild.getChild(this); + } + + public void setExpression(Expression expression) { + expressionChild.setChild(this, expression); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ContextEntry.class, DMN_ELEMENT_CONTEXT_ENTRY) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public ContextEntry newInstance(ModelTypeInstanceContext instanceContext) { + return new ContextEntryImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + variableChild = sequenceBuilder.element(Variable.class) + .build(); + + expressionChild = sequenceBuilder.element(Expression.class) + .required() + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ContextImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ContextImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..39e3b919a6176f01c59b56bd634c358c982e8171 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ContextImpl.java @@ -0,0 +1,64 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_CONTEXT; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.Context; +import org.camunda.bpm.model.dmn.instance.ContextEntry; +import org.camunda.bpm.model.dmn.instance.Expression; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class ContextImpl extends ExpressionImpl implements Context { + + protected static ChildElementCollection contextEntryCollection; + + public ContextImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Collection getContextEntries() { + return contextEntryCollection.get(this); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Context.class, DMN_ELEMENT_CONTEXT) + .namespaceUri(LATEST_DMN_NS) + .extendsType(Expression.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Context newInstance(ModelTypeInstanceContext instanceContext) { + return new ContextImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + contextEntryCollection = sequenceBuilder.elementCollection(ContextEntry.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0e8597c722bc6e21e4db38642ea5d958cfaa7bba --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionImpl.java @@ -0,0 +1,249 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.CAMUNDA_ATTRIBUTE_HISTORY_TIME_TO_LIVE; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.CAMUNDA_ATTRIBUTE_VERSION_TAG; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.CAMUNDA_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_DECISION; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.AllowedAnswers; +import org.camunda.bpm.model.dmn.instance.AuthorityRequirement; +import org.camunda.bpm.model.dmn.instance.Decision; +import org.camunda.bpm.model.dmn.instance.DecisionMakerReference; +import org.camunda.bpm.model.dmn.instance.DecisionOwnerReference; +import org.camunda.bpm.model.dmn.instance.DrgElement; +import org.camunda.bpm.model.dmn.instance.Expression; +import org.camunda.bpm.model.dmn.instance.ImpactedPerformanceIndicatorReference; +import org.camunda.bpm.model.dmn.instance.InformationRequirement; +import org.camunda.bpm.model.dmn.instance.KnowledgeRequirement; +import org.camunda.bpm.model.dmn.instance.OrganizationUnit; +import org.camunda.bpm.model.dmn.instance.PerformanceIndicator; +import org.camunda.bpm.model.dmn.instance.Question; +import org.camunda.bpm.model.dmn.instance.SupportedObjectiveReference; +import org.camunda.bpm.model.dmn.instance.UsingProcessReference; +import org.camunda.bpm.model.dmn.instance.UsingTaskReference; +import org.camunda.bpm.model.dmn.instance.Variable; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollection; + +public class DecisionImpl extends DrgElementImpl implements Decision { + + protected static ChildElement questionChild; + protected static ChildElement allowedAnswersChild; + protected static ChildElement variableChild; + protected static ChildElementCollection informationRequirementCollection; + protected static ChildElementCollection knowledgeRequirementCollection; + protected static ChildElementCollection authorityRequirementCollection; + protected static ChildElementCollection supportedObjectiveChildElementCollection; + protected static ElementReferenceCollection impactedPerformanceIndicatorRefCollection; + protected static ElementReferenceCollection decisionMakerRefCollection; + protected static ElementReferenceCollection decisionOwnerRefCollection; + protected static ChildElementCollection usingProcessCollection; + protected static ChildElementCollection usingTaskCollection; + protected static ChildElement expressionChild; + + // camunda extensions + protected static Attribute camundaHistoryTimeToLiveAttribute; + protected static Attribute camundaVersionTag; + + public DecisionImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Question getQuestion() { + return questionChild.getChild(this); + } + + public void setQuestion(Question question) { + questionChild.setChild(this, question); + } + + public AllowedAnswers getAllowedAnswers() { + return allowedAnswersChild.getChild(this); + } + + public void setAllowedAnswers(AllowedAnswers allowedAnswers) { + allowedAnswersChild.setChild(this, allowedAnswers); + } + + public Variable getVariable() { + return variableChild.getChild(this); + } + + public void setVariable(Variable variable) { + variableChild.setChild(this, variable); + } + + public Collection getInformationRequirements() { + return informationRequirementCollection.get(this); + } + + public Collection getKnowledgeRequirements() { + return knowledgeRequirementCollection.get(this); + } + + public Collection getAuthorityRequirements() { + return authorityRequirementCollection.get(this); + } + + public Collection getSupportedObjectiveReferences() { + return supportedObjectiveChildElementCollection.get(this); + } + + public Collection getImpactedPerformanceIndicators() { + return impactedPerformanceIndicatorRefCollection.getReferenceTargetElements(this); + } + + public Collection getDecisionMakers() { + return decisionMakerRefCollection.getReferenceTargetElements(this); + } + + public Collection getDecisionOwners() { + return decisionOwnerRefCollection.getReferenceTargetElements(this); + } + + public Collection getUsingProcessReferences() { + return usingProcessCollection.get(this); + } + + public Collection getUsingTaskReferences() { + return usingTaskCollection.get(this); + } + + public Expression getExpression() { + return expressionChild.getChild(this); + } + + public void setExpression(Expression expression) { + expressionChild.setChild(this, expression); + } + + // camunda extensions + @Override + public Integer getCamundaHistoryTimeToLive() { + String ttl = getCamundaHistoryTimeToLiveString(); + + if (ttl != null) { + return Integer.valueOf(ttl); + } + return null; + } + + @Override + public void setCamundaHistoryTimeToLive(Integer historyTimeToLive) { + setCamundaHistoryTimeToLiveString(String.valueOf(historyTimeToLive)); + } + + @Override + public String getCamundaHistoryTimeToLiveString() { + return camundaHistoryTimeToLiveAttribute.getValue(this); + } + + @Override + public void setCamundaHistoryTimeToLiveString(String historyTimeToLive) { + camundaHistoryTimeToLiveAttribute.setValue(this, historyTimeToLive); + } + + @Override + public String getVersionTag() { + return camundaVersionTag.getValue(this); + } + + @Override + public void setVersionTag(String inputVariable) { + camundaVersionTag.setValue(this, inputVariable); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Decision.class, DMN_ELEMENT_DECISION) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DrgElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Decision newInstance(ModelTypeInstanceContext instanceContext) { + return new DecisionImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + questionChild = sequenceBuilder.element(Question.class) + .build(); + + allowedAnswersChild = sequenceBuilder.element(AllowedAnswers.class) + .build(); + + variableChild = sequenceBuilder.element(Variable.class) + .build(); + + informationRequirementCollection = sequenceBuilder.elementCollection(InformationRequirement.class) + .build(); + + knowledgeRequirementCollection = sequenceBuilder.elementCollection(KnowledgeRequirement.class) + .build(); + + authorityRequirementCollection = sequenceBuilder.elementCollection(AuthorityRequirement.class) + .build(); + + supportedObjectiveChildElementCollection = sequenceBuilder.elementCollection(SupportedObjectiveReference.class) + .build(); + + impactedPerformanceIndicatorRefCollection = sequenceBuilder.elementCollection(ImpactedPerformanceIndicatorReference.class) + .uriElementReferenceCollection(PerformanceIndicator.class) + .build(); + + decisionMakerRefCollection = sequenceBuilder.elementCollection(DecisionMakerReference.class) + .uriElementReferenceCollection(OrganizationUnit.class) + .build(); + + decisionOwnerRefCollection = sequenceBuilder.elementCollection(DecisionOwnerReference.class) + .uriElementReferenceCollection(OrganizationUnit.class) + .build(); + + usingProcessCollection = sequenceBuilder.elementCollection(UsingProcessReference.class) + .build(); + + usingTaskCollection = sequenceBuilder.elementCollection(UsingTaskReference.class) + .build(); + + expressionChild = sequenceBuilder.element(Expression.class) + .build(); + + // camunda extensions + + camundaHistoryTimeToLiveAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_HISTORY_TIME_TO_LIVE) + .namespace(CAMUNDA_NS) + .build(); + + camundaVersionTag = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_VERSION_TAG) + .namespace(CAMUNDA_NS) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionMadeReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionMadeReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..5ad916967d43749c7600d1d922d815dd6963a8e0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionMadeReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_DECISION_MADE; + +import org.camunda.bpm.model.dmn.instance.DecisionMadeReference; +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class DecisionMadeReferenceImpl extends DmnElementReferenceImpl implements DecisionMadeReference { + + public DecisionMadeReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DecisionMadeReference.class, DMN_ELEMENT_DECISION_MADE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public DecisionMadeReference newInstance(ModelTypeInstanceContext instanceContext) { + return new DecisionMadeReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionMakerReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionMakerReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..706d3c7625cf0ff0f8be897056b9ec4bc7f2d37b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionMakerReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_DECISION_MAKER; + +import org.camunda.bpm.model.dmn.instance.DecisionMakerReference; +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class DecisionMakerReferenceImpl extends DmnElementReferenceImpl implements DecisionMakerReference { + + public DecisionMakerReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DecisionMakerReference.class, DMN_ELEMENT_DECISION_MAKER) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public DecisionMakerReference newInstance(ModelTypeInstanceContext instanceContext) { + return new DecisionMakerReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionOwnedReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionOwnedReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..e15e9acd3e4227d3e0945e02b9d895f84b2caa84 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionOwnedReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_DECISION_OWNED; + +import org.camunda.bpm.model.dmn.instance.DecisionOwnedReference; +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class DecisionOwnedReferenceImpl extends DmnElementReferenceImpl implements DecisionOwnedReference { + + public DecisionOwnedReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DecisionOwnedReference.class, DMN_ELEMENT_DECISION_OWNED) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public DecisionOwnedReference newInstance(ModelTypeInstanceContext instanceContext) { + return new DecisionOwnedReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionOwnerReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionOwnerReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..00014b76749aadbe6725a47c30b97185e5e69ae6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionOwnerReferenceImpl.java @@ -0,0 +1,47 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_DECISION_OWNER; + +import org.camunda.bpm.model.dmn.instance.DecisionOwnerReference; +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class DecisionOwnerReferenceImpl extends DmnElementReferenceImpl implements DecisionOwnerReference { + + public DecisionOwnerReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DecisionOwnerReference.class, DMN_ELEMENT_DECISION_OWNER) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public DecisionOwnerReference newInstance(ModelTypeInstanceContext instanceContext) { + return new DecisionOwnerReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionRuleImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionRuleImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..3ba1a59b1899e3b90ca5105712d5bb12e3069b85 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionRuleImpl.java @@ -0,0 +1,74 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_DECISION_RULE; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.DecisionRule; +import org.camunda.bpm.model.dmn.instance.DmnElement; +import org.camunda.bpm.model.dmn.instance.InputEntry; +import org.camunda.bpm.model.dmn.instance.OutputEntry; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class DecisionRuleImpl extends DmnElementImpl implements DecisionRule { + + protected static ChildElementCollection inputEntryCollection; + protected static ChildElementCollection outputEntryCollection; + + public DecisionRuleImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Collection getInputEntries() { + return inputEntryCollection.get(this); + } + + public Collection getOutputEntries() { + return outputEntryCollection.get(this); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DecisionRule.class, DMN_ELEMENT_DECISION_RULE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public DecisionRule newInstance(ModelTypeInstanceContext instanceContext) { + return new DecisionRuleImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + inputEntryCollection = sequenceBuilder.elementCollection(InputEntry.class) + .build(); + + outputEntryCollection = sequenceBuilder.elementCollection(OutputEntry.class) + .required() + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionServiceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..09b23c1276f6494070f77d98a7b7746ed16c0ae6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionServiceImpl.java @@ -0,0 +1,98 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_DECISION_SERVICE; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.Decision; +import org.camunda.bpm.model.dmn.instance.DecisionService; +import org.camunda.bpm.model.dmn.instance.EncapsulatedDecisionReference; +import org.camunda.bpm.model.dmn.instance.InputData; +import org.camunda.bpm.model.dmn.instance.InputDataReference; +import org.camunda.bpm.model.dmn.instance.InputDecisionReference; +import org.camunda.bpm.model.dmn.instance.NamedElement; +import org.camunda.bpm.model.dmn.instance.OutputDecisionReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollection; + +public class DecisionServiceImpl extends NamedElementImpl implements DecisionService { + + protected static ElementReferenceCollection outputDecisionRefCollection; + protected static ElementReferenceCollection encapsulatedDecisionRefCollection; + protected static ElementReferenceCollection inputDecisionRefCollection; + protected static ElementReferenceCollection inputDataRefCollection; + + public DecisionServiceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Collection getOutputDecisions() { + return outputDecisionRefCollection.getReferenceTargetElements(this); + } + + public Collection getEncapsulatedDecisions() { + return encapsulatedDecisionRefCollection.getReferenceTargetElements(this); + } + + public Collection getInputDecisions() { + return inputDecisionRefCollection.getReferenceTargetElements(this); + } + + public Collection getInputData() { + return inputDataRefCollection.getReferenceTargetElements(this); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DecisionService.class, DMN_ELEMENT_DECISION_SERVICE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(NamedElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public DecisionService newInstance(ModelTypeInstanceContext instanceContext) { + return new DecisionServiceImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + outputDecisionRefCollection = sequenceBuilder.elementCollection(OutputDecisionReference.class) + .required() + .uriElementReferenceCollection(Decision.class) + .build(); + + encapsulatedDecisionRefCollection = sequenceBuilder.elementCollection(EncapsulatedDecisionReference.class) + .uriElementReferenceCollection(Decision.class) + .build(); + + inputDecisionRefCollection = sequenceBuilder.elementCollection(InputDecisionReference.class) + .uriElementReferenceCollection(Decision.class) + .build(); + + inputDataRefCollection = sequenceBuilder.elementCollection(InputDataReference.class) + .uriElementReferenceCollection(InputData.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionTableImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionTableImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..d6b0dd56cccf04c8143ed8acebce27d94a7fb48c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DecisionTableImpl.java @@ -0,0 +1,142 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_AGGREGATION; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_HIT_POLICY; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_OUTPUT_LABEL; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_PREFERRED_ORIENTATION; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_DECISION_TABLE; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.BuiltinAggregator; +import org.camunda.bpm.model.dmn.DecisionTableOrientation; +import org.camunda.bpm.model.dmn.HitPolicy; +import org.camunda.bpm.model.dmn.instance.DecisionTable; +import org.camunda.bpm.model.dmn.instance.Expression; +import org.camunda.bpm.model.dmn.instance.Input; +import org.camunda.bpm.model.dmn.instance.Output; +import org.camunda.bpm.model.dmn.instance.Rule; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class DecisionTableImpl extends ExpressionImpl implements DecisionTable { + + protected static Attribute hitPolicyAttribute; + protected static Attribute aggregationAttribute; + protected static Attribute preferredOrientationAttribute; + protected static Attribute outputLabelAttribute; + + protected static ChildElementCollection inputCollection; + protected static ChildElementCollection outputCollection; + protected static ChildElementCollection ruleCollection; + + public DecisionTableImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public HitPolicy getHitPolicy() { + return hitPolicyAttribute.getValue(this); + } + + public void setHitPolicy(HitPolicy hitPolicy) { + hitPolicyAttribute.setValue(this, hitPolicy); + } + + public BuiltinAggregator getAggregation() { + return aggregationAttribute.getValue(this); + } + + public void setAggregation(BuiltinAggregator aggregation) { + aggregationAttribute.setValue(this, aggregation); + } + + public DecisionTableOrientation getPreferredOrientation() { + return preferredOrientationAttribute.getValue(this); + } + + public void setPreferredOrientation(DecisionTableOrientation preferredOrientation) { + preferredOrientationAttribute.setValue(this, preferredOrientation); + } + + public String getOutputLabel() { + return outputLabelAttribute.getValue(this); + } + + public void setOutputLabel(String outputLabel) { + outputLabelAttribute.setValue(this, outputLabel); + } + + public Collection getInputs() { + return inputCollection.get(this); + } + + public Collection getOutputs() { + return outputCollection.get(this); + } + + public Collection getRules() { + return ruleCollection.get(this); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DecisionTable.class, DMN_ELEMENT_DECISION_TABLE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(Expression.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public DecisionTable newInstance(ModelTypeInstanceContext instanceContext) { + return new DecisionTableImpl(instanceContext); + } + }); + + hitPolicyAttribute = typeBuilder.namedEnumAttribute(DMN_ATTRIBUTE_HIT_POLICY, HitPolicy.class) + .defaultValue(HitPolicy.UNIQUE) + .build(); + + aggregationAttribute = typeBuilder.enumAttribute(DMN_ATTRIBUTE_AGGREGATION, BuiltinAggregator.class) + .build(); + + preferredOrientationAttribute = typeBuilder.namedEnumAttribute(DMN_ATTRIBUTE_PREFERRED_ORIENTATION, DecisionTableOrientation.class) + .defaultValue(DecisionTableOrientation.Rule_as_Row) + .build(); + + outputLabelAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_OUTPUT_LABEL) + .build(); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + inputCollection = sequenceBuilder.elementCollection(Input.class) + .build(); + + outputCollection = sequenceBuilder.elementCollection(Output.class) + .required() + .build(); + + ruleCollection = sequenceBuilder.elementCollection(Rule.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DefaultOutputEntryImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DefaultOutputEntryImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..3eaa9ebcba9ca651bf14121504f5dd36b4f2060b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DefaultOutputEntryImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_DEFAULT_OUTPUT_ENTRY; + +import org.camunda.bpm.model.dmn.instance.DefaultOutputEntry; +import org.camunda.bpm.model.dmn.instance.LiteralExpression; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class DefaultOutputEntryImpl extends LiteralExpressionImpl implements DefaultOutputEntry { + + public DefaultOutputEntryImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DefaultOutputEntry.class, DMN_ELEMENT_DEFAULT_OUTPUT_ENTRY) + .namespaceUri(LATEST_DMN_NS) + .extendsType(LiteralExpression.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public DefaultOutputEntry newInstance(ModelTypeInstanceContext instanceContext) { + return new DefaultOutputEntryImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DefinitionsImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DefinitionsImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..64e5dd73658534d88ed19867847d79001212c42f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DefinitionsImpl.java @@ -0,0 +1,178 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_EXPORTER; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_EXPORTER_VERSION; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_EXPRESSION_LANGUAGE; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_NAMESPACE; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_TYPE_LANGUAGE; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_DEFINITIONS; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.Artifact; +import org.camunda.bpm.model.dmn.instance.BusinessContextElement; +import org.camunda.bpm.model.dmn.instance.Definitions; +import org.camunda.bpm.model.dmn.instance.DrgElement; +import org.camunda.bpm.model.dmn.instance.ElementCollection; +import org.camunda.bpm.model.dmn.instance.Import; +import org.camunda.bpm.model.dmn.instance.ItemDefinition; +import org.camunda.bpm.model.dmn.instance.NamedElement; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class DefinitionsImpl extends NamedElementImpl implements Definitions { + + protected static Attribute expressionLanguageAttribute; + protected static Attribute typeLanguageAttribute; + protected static Attribute namespaceAttribute; + protected static Attribute exporterAttribute; + protected static Attribute exporterVersionAttribute; + + protected static ChildElementCollection importCollection; + protected static ChildElementCollection itemDefinitionCollection; + protected static ChildElementCollection drgElementCollection; + protected static ChildElementCollection artifactCollection; + protected static ChildElementCollection elementCollectionCollection; + protected static ChildElementCollection businessContextElementCollection; + + public DefinitionsImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getExpressionLanguage() { + return expressionLanguageAttribute.getValue(this); + } + + public void setExpressionLanguage(String expressionLanguage) { + expressionLanguageAttribute.setValue(this, expressionLanguage); + } + + public String getTypeLanguage() { + return typeLanguageAttribute.getValue(this); + } + + public void setTypeLanguage(String typeLanguage) { + typeLanguageAttribute.setValue(this, typeLanguage); + } + + public String getNamespace() { + return namespaceAttribute.getValue(this); + } + + public void setNamespace(String namespace) { + namespaceAttribute.setValue(this, namespace); + } + + public String getExporter() { + return exporterAttribute.getValue(this); + } + + public void setExporter(String exporter) { + exporterAttribute.setValue(this, exporter); + } + + public String getExporterVersion() { + return exporterVersionAttribute.getValue(this); + } + + public void setExporterVersion(String exporterVersion) { + exporterVersionAttribute.setValue(this, exporterVersion); + } + + public Collection getImports() { + return importCollection.get(this); + } + + public Collection getItemDefinitions() { + return itemDefinitionCollection.get(this); + } + + public Collection getDrgElements() { + return drgElementCollection.get(this); + } + + public Collection getArtifacts() { + return artifactCollection.get(this); + } + + public Collection getElementCollections() { + return elementCollectionCollection.get(this); + } + + public Collection getBusinessContextElements() { + return businessContextElementCollection.get(this); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Definitions.class, DMN_ELEMENT_DEFINITIONS) + .namespaceUri(LATEST_DMN_NS) + .extendsType(NamedElement.class) + .instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider() { + public Definitions newInstance(ModelTypeInstanceContext instanceContext) { + return new DefinitionsImpl(instanceContext); + } + }); + + expressionLanguageAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_EXPRESSION_LANGUAGE) + .defaultValue("http://www.omg.org/spec/FEEL/20140401") + .build(); + + typeLanguageAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_TYPE_LANGUAGE) + .defaultValue("http://www.omg.org/spec/FEEL/20140401") + .build(); + + namespaceAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_NAMESPACE) + .required() + .build(); + + exporterAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_EXPORTER) + .build(); + + exporterVersionAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_EXPORTER_VERSION) + .build(); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + importCollection = sequenceBuilder.elementCollection(Import.class) + .build(); + + itemDefinitionCollection = sequenceBuilder.elementCollection(ItemDefinition.class) + .build(); + + drgElementCollection = sequenceBuilder.elementCollection(DrgElement.class) + .build(); + + artifactCollection = sequenceBuilder.elementCollection(Artifact.class) + .build(); + + elementCollectionCollection = sequenceBuilder.elementCollection(ElementCollection.class) + .build(); + + businessContextElementCollection = sequenceBuilder.elementCollection(BusinessContextElement.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DescriptionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DescriptionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9837fd78d36c9c66cb1be6766b4bf2a420fd7fef --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DescriptionImpl.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_DESCRIPTION; + +import org.camunda.bpm.model.dmn.instance.Description; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class DescriptionImpl extends DmnModelElementInstanceImpl implements Description { + + public DescriptionImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Description.class, DMN_ELEMENT_DESCRIPTION) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public Description newInstance(ModelTypeInstanceContext instanceContext) { + return new DescriptionImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DmnElementImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DmnElementImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..b7e45d46651dcbe71a89fbb0a8aa35f9b859857c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DmnElementImpl.java @@ -0,0 +1,101 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_ID; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_LABEL; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT; + +import org.camunda.bpm.model.dmn.instance.Description; +import org.camunda.bpm.model.dmn.instance.DmnElement; +import org.camunda.bpm.model.dmn.instance.ExtensionElements; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public abstract class DmnElementImpl extends DmnModelElementInstanceImpl implements DmnElement { + + protected static Attribute idAttribute; + protected static Attribute labelAttribute; + + protected static ChildElement descriptionChild; + protected static ChildElement extensionElementsChild; + + public DmnElementImpl (ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getId() { + return idAttribute.getValue(this); + } + + public void setId(String id) { + idAttribute.setValue(this, id); + } + + public String getLabel() { + return labelAttribute.getValue(this); + } + + public void setLabel(String label) { + labelAttribute.setValue(this, label); + } + + public Description getDescription() { + return descriptionChild.getChild(this); + } + + public void setDescription(Description description) { + descriptionChild.setChild(this, description); + } + + public ExtensionElements getExtensionElements() { + return extensionElementsChild.getChild(this); + } + + public void setExtensionElements(ExtensionElements extensionElements) { + extensionElementsChild.setChild(this, extensionElements); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DmnElement.class, DMN_ELEMENT) + .namespaceUri(LATEST_DMN_NS) + .abstractType(); + + idAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_ID) + .idAttribute() + .build(); + + labelAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_LABEL) + .build(); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + descriptionChild = sequenceBuilder.element(Description.class) + .build(); + + extensionElementsChild = sequenceBuilder.element(ExtensionElements.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DmnElementReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DmnElementReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..a256834ffb3281404290b3802a9163a8bb6ef7ed --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DmnElementReferenceImpl.java @@ -0,0 +1,62 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_HREF; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_REFERENCE; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; + +public class DmnElementReferenceImpl extends DmnModelElementInstanceImpl implements DmnElementReference { + + protected static Attribute hrefAttribute; + + public DmnElementReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getHref() { + return hrefAttribute.getValue(this); + } + + public void setHref(String href) { + hrefAttribute.setValue(this, href); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DmnElementReference.class, DMN_ELEMENT_REFERENCE) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public DmnElementReference newInstance(ModelTypeInstanceContext instanceContext) { + return new DmnElementReferenceImpl(instanceContext); + } + }); + + hrefAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_HREF) + .required() + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DmnModelElementInstanceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DmnModelElementInstanceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9056a661fcfadd3e434ff3b39e27cdacb27f5bc6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DmnModelElementInstanceImpl.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import org.camunda.bpm.model.dmn.instance.DmnModelElementInstance; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; + +public abstract class DmnModelElementInstanceImpl extends ModelElementInstanceImpl implements DmnModelElementInstance { + + public DmnModelElementInstanceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DrgElementImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DrgElementImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..bbae87134cf2ac7360527bd0d1a1040871ba7a09 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DrgElementImpl.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_DRG_ELEMENT; + +import org.camunda.bpm.model.dmn.instance.DrgElement; +import org.camunda.bpm.model.dmn.instance.NamedElement; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; + +public abstract class DrgElementImpl extends NamedElementImpl implements DrgElement { + + public DrgElementImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DrgElement.class, DMN_ELEMENT_DRG_ELEMENT) + .namespaceUri(LATEST_DMN_NS) + .extendsType(NamedElement.class) + .abstractType(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DrgElementReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DrgElementReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..1c34587bafa65bc1fb494da0e7950b79a7046ec0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/DrgElementReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_DRG_ELEMENT_REFERENCE; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.DrgElementReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class DrgElementReferenceImpl extends DmnElementReferenceImpl implements DrgElementReference { + + public DrgElementReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DrgElementReference.class, DMN_ELEMENT_DRG_ELEMENT_REFERENCE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public DrgElementReference newInstance(ModelTypeInstanceContext instanceContext) { + return new DrgElementReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ElementCollectionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ElementCollectionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..f148ef7ad05cdc93344df03d8e8180e7c4a5f159 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ElementCollectionImpl.java @@ -0,0 +1,66 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_ELEMENT_COLLECTION; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.DrgElement; +import org.camunda.bpm.model.dmn.instance.DrgElementReference; +import org.camunda.bpm.model.dmn.instance.ElementCollection; +import org.camunda.bpm.model.dmn.instance.NamedElement; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollection; + +public class ElementCollectionImpl extends NamedElementImpl implements ElementCollection { + + protected static ElementReferenceCollection drgElementRefCollection; + + public ElementCollectionImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Collection getDrgElements() { + return drgElementRefCollection.getReferenceTargetElements(this); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ElementCollection.class, DMN_ELEMENT_ELEMENT_COLLECTION) + .namespaceUri(LATEST_DMN_NS) + .extendsType(NamedElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public ElementCollection newInstance(ModelTypeInstanceContext instanceContext) { + return new ElementCollectionImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + drgElementRefCollection = sequenceBuilder.elementCollection(DrgElementReference.class) + .uriElementReferenceCollection(DrgElement.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/EncapsulatedDecisionReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/EncapsulatedDecisionReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..a2c648fc7f4388f782bc85710b7b5d538c1c5e27 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/EncapsulatedDecisionReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_ENCAPSULATED_DECISION_REFERENCE; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.EncapsulatedDecisionReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class EncapsulatedDecisionReferenceImpl extends DmnElementReferenceImpl implements EncapsulatedDecisionReference { + + public EncapsulatedDecisionReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(EncapsulatedDecisionReference.class, DMN_ELEMENT_ENCAPSULATED_DECISION_REFERENCE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public EncapsulatedDecisionReference newInstance(ModelTypeInstanceContext instanceContext) { + return new EncapsulatedDecisionReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/EncapsulatedLogicImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/EncapsulatedLogicImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..42317fcaae7ca30ecb2f89184980043e3379b391 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/EncapsulatedLogicImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_ENCAPSULATED_LOGIC; + +import org.camunda.bpm.model.dmn.instance.EncapsulatedLogic; +import org.camunda.bpm.model.dmn.instance.FunctionDefinition; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class EncapsulatedLogicImpl extends FunctionDefinitionImpl implements EncapsulatedLogic { + + public EncapsulatedLogicImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(EncapsulatedLogic.class, DMN_ELEMENT_ENCAPSULATED_LOGIC) + .namespaceUri(LATEST_DMN_NS) + .extendsType(FunctionDefinition.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public EncapsulatedLogic newInstance(ModelTypeInstanceContext instanceContext) { + return new EncapsulatedLogicImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ExpressionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ExpressionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..942af961faacf43bb7bd05fe68f33d0226bfda91 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ExpressionImpl.java @@ -0,0 +1,58 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_TYPE_REF; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_EXPRESSION; + +import org.camunda.bpm.model.dmn.instance.DmnElement; +import org.camunda.bpm.model.dmn.instance.Expression; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.attribute.Attribute; + +public abstract class ExpressionImpl extends DmnElementImpl implements Expression { + + protected static Attribute typeRefAttribute; + + public ExpressionImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getTypeRef() { + return typeRefAttribute.getValue(this); + } + + public void setTypeRef(String typeRef) { + typeRefAttribute.setValue(this, typeRef); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Expression.class, DMN_ELEMENT_EXPRESSION) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElement.class) + .abstractType(); + + typeRefAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_TYPE_REF) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ExtensionElementsImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ExtensionElementsImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0538b523a76bcb7882c8efb0a2aeae3bb297f329 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ExtensionElementsImpl.java @@ -0,0 +1,82 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_EXTENSION_ELEMENTS; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.Query; +import org.camunda.bpm.model.dmn.impl.QueryImpl; +import org.camunda.bpm.model.dmn.instance.ExtensionElements; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.impl.util.ModelUtil; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; + +/** + * The DMN extensionElements element + */ +public class ExtensionElementsImpl extends DmnModelElementInstanceImpl implements ExtensionElements { + + public static void registerType(ModelBuilder modelBuilder) { + + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ExtensionElements.class, DMN_ELEMENT_EXTENSION_ELEMENTS) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider() { + public ExtensionElements newInstance(ModelTypeInstanceContext instanceContext) { + return new ExtensionElementsImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + + public ExtensionElementsImpl(ModelTypeInstanceContext context) { + super(context); + } + + public Collection getElements() { + return ModelUtil.getModelElementCollection(getDomElement().getChildElements(), modelInstance); + } + + public Query getElementsQuery() { + return new QueryImpl(getElements()); + } + + public ModelElementInstance addExtensionElement(String namespaceUri, String localName) { + ModelElementType extensionElementType = modelInstance.registerGenericType(namespaceUri, localName); + ModelElementInstance extensionElement = extensionElementType.newInstance(modelInstance); + addChildElement(extensionElement); + return extensionElement; + } + + public T addExtensionElement(Class extensionElementClass) { + ModelElementInstance extensionElement = modelInstance.newInstance(extensionElementClass); + addChildElement(extensionElement); + return extensionElementClass.cast(extensionElement); + } + + @Override + public void addChildElement(ModelElementInstance extensionElement) { + getDomElement().appendChild(extensionElement.getDomElement()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/FormalParameterImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/FormalParameterImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..8507ff9e33e5165f826ec124d2c097397a4de49f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/FormalParameterImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_FORMAL_PARAMETER; + +import org.camunda.bpm.model.dmn.instance.FormalParameter; +import org.camunda.bpm.model.dmn.instance.InformationItem; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class FormalParameterImpl extends InformationItemImpl implements FormalParameter { + + public FormalParameterImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(FormalParameter.class, DMN_ELEMENT_FORMAL_PARAMETER) + .namespaceUri(LATEST_DMN_NS) + .extendsType(InformationItem.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public FormalParameter newInstance(ModelTypeInstanceContext instanceContext) { + return new FormalParameterImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/FunctionDefinitionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/FunctionDefinitionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..cd44f3f86e9a32fa26ddee5b29a1875a4e25abbf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/FunctionDefinitionImpl.java @@ -0,0 +1,77 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_FUNCTION_DEFINITION; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.Expression; +import org.camunda.bpm.model.dmn.instance.FormalParameter; +import org.camunda.bpm.model.dmn.instance.FunctionDefinition; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class FunctionDefinitionImpl extends ExpressionImpl implements FunctionDefinition { + + protected static ChildElementCollection formalParameterCollection; + protected static ChildElement expressionChild; + + public FunctionDefinitionImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Collection getFormalParameters() { + return formalParameterCollection.get(this); + } + + public Expression getExpression() { + return expressionChild.getChild(this); + } + + public void setExpression(Expression expression) { + expressionChild.setChild(this, expression); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(FunctionDefinition.class, DMN_ELEMENT_FUNCTION_DEFINITION) + .namespaceUri(LATEST_DMN_NS) + .extendsType(Expression.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public FunctionDefinition newInstance(ModelTypeInstanceContext instanceContext) { + return new FunctionDefinitionImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + formalParameterCollection = sequenceBuilder.elementCollection(FormalParameter.class) + .build(); + + expressionChild = sequenceBuilder.element(Expression.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImpactedPerformanceIndicatorReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImpactedPerformanceIndicatorReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..50db5636b0f86e8545720ce5fd3ad6cb88909ac4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImpactedPerformanceIndicatorReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_IMPACTED_PERFORMANCE_INDICATOR; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.ImpactedPerformanceIndicatorReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class ImpactedPerformanceIndicatorReferenceImpl extends DmnElementReferenceImpl implements ImpactedPerformanceIndicatorReference { + + public ImpactedPerformanceIndicatorReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ImpactedPerformanceIndicatorReference.class, DMN_ELEMENT_IMPACTED_PERFORMANCE_INDICATOR) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public ImpactedPerformanceIndicatorReference newInstance(ModelTypeInstanceContext instanceContext) { + return new ImpactedPerformanceIndicatorReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImpactingDecisionReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImpactingDecisionReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..5bfe508d0351de14fa9eeab1fae9afac5120b1d0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImpactingDecisionReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_IMPACTING_DECISION; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.ImpactingDecisionReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class ImpactingDecisionReferenceImpl extends DmnElementReferenceImpl implements ImpactingDecisionReference { + + public ImpactingDecisionReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ImpactingDecisionReference.class, DMN_ELEMENT_IMPACTING_DECISION) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public ImpactingDecisionReference newInstance(ModelTypeInstanceContext instanceContext) { + return new ImpactingDecisionReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImportImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImportImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..b6ad2eb0be1090497ce4393aa865c9ebae0eacb5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImportImpl.java @@ -0,0 +1,89 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_IMPORT_TYPE; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_LOCATION_URI; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_NAMESPACE; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_IMPORT; + +import org.camunda.bpm.model.dmn.instance.Import; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; + +public class ImportImpl extends DmnModelElementInstanceImpl implements Import { + + protected static Attribute namespaceAttribute; + protected static Attribute locationUriAttribute; + protected static Attribute importTypeAttribute; + + public ImportImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getNamespace() { + return namespaceAttribute.getValue(this); + } + + public void setNamespace(String namespace) { + namespaceAttribute.setValue(this, namespace); + } + + public String getLocationUri() { + return locationUriAttribute.getValue(this); + } + + public void setLocationUri(String locationUri) { + locationUriAttribute.setValue(this, locationUri); + } + + public String getImportType() { + return importTypeAttribute.getValue(this); + } + + public void setImportType(String importType) { + importTypeAttribute.setValue(this, importType); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Import.class, DMN_ELEMENT_IMPORT) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public Import newInstance(ModelTypeInstanceContext instanceContext) { + return new ImportImpl(instanceContext); + } + }); + + namespaceAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_NAMESPACE) + .required() + .build(); + + locationUriAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_LOCATION_URI) + .build(); + + importTypeAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_IMPORT_TYPE) + .required() + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImportedElementImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImportedElementImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9183486ed4845bb2b03b0a09ad4645e2f2571d98 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImportedElementImpl.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_IMPORTED_ELEMENT; + +import org.camunda.bpm.model.dmn.instance.ImportedElement; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class ImportedElementImpl extends DmnModelElementInstanceImpl implements ImportedElement { + + public ImportedElementImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ImportedElement.class, DMN_ELEMENT_IMPORTED_ELEMENT) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public ImportedElement newInstance(ModelTypeInstanceContext instanceContext) { + return new ImportedElementImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImportedValuesImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImportedValuesImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..681d888d36e270dabece15abeaefbbf855e82b04 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ImportedValuesImpl.java @@ -0,0 +1,82 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_EXPRESSION_LANGUAGE; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_IMPORTED_VALUES; + +import org.camunda.bpm.model.dmn.instance.Import; +import org.camunda.bpm.model.dmn.instance.ImportedElement; +import org.camunda.bpm.model.dmn.instance.ImportedValues; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class ImportedValuesImpl extends ImportImpl implements ImportedValues { + + protected static Attribute expressionLanguageAttribute; + + protected static ChildElement importedElementChild; + + public ImportedValuesImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getExpressionLanguage() { + return expressionLanguageAttribute.getValue(this); + } + + public void setExpressionLanguage(String expressionLanguage) { + expressionLanguageAttribute.setValue(this, expressionLanguage); + } + + public ImportedElement getImportedElement() { + return importedElementChild.getChild(this); + } + + public void setImportedElement(ImportedElement importedElement) { + importedElementChild.setChild(this, importedElement); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ImportedValues.class, DMN_ELEMENT_IMPORTED_VALUES) + .namespaceUri(LATEST_DMN_NS) + .extendsType(Import.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public ImportedValues newInstance(ModelTypeInstanceContext instanceContext) { + return new ImportedValuesImpl(instanceContext); + } + }); + + expressionLanguageAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_EXPRESSION_LANGUAGE) + .build(); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + importedElementChild = sequenceBuilder.element(ImportedElement.class) + .required() + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InformationItemImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InformationItemImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..d994d54c1345a8ac388b835d42e46ccba996d9af --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InformationItemImpl.java @@ -0,0 +1,63 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_TYPE_REF; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_INFORMATION_ITEM; + +import org.camunda.bpm.model.dmn.instance.InformationItem; +import org.camunda.bpm.model.dmn.instance.NamedElement; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; + +public class InformationItemImpl extends NamedElementImpl implements InformationItem { + + protected static Attribute typeRefAttribute; + + public InformationItemImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getTypeRef() { + return typeRefAttribute.getValue(this); + } + + public void setTypeRef(String typeRef) { + typeRefAttribute.setValue(this, typeRef); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(InformationItem.class, DMN_ELEMENT_INFORMATION_ITEM) + .namespaceUri(LATEST_DMN_NS) + .extendsType(NamedElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public InformationItem newInstance(ModelTypeInstanceContext instanceContext) { + return new InformationItemImpl(instanceContext); + } + }); + + typeRefAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_TYPE_REF) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InformationRequirementImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InformationRequirementImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c20dfee029e55e23e609557b8da1fcbaeeddaf6f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InformationRequirementImpl.java @@ -0,0 +1,81 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_INFORMATION_REQUIREMENT; + +import org.camunda.bpm.model.dmn.instance.Decision; +import org.camunda.bpm.model.dmn.instance.InformationRequirement; +import org.camunda.bpm.model.dmn.instance.InputData; +import org.camunda.bpm.model.dmn.instance.RequiredDecisionReference; +import org.camunda.bpm.model.dmn.instance.RequiredInputReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReference; + +public class InformationRequirementImpl extends DmnModelElementInstanceImpl implements InformationRequirement { + + protected static ElementReference requiredDecisionRef; + protected static ElementReference requiredInputRef; + + public InformationRequirementImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Decision getRequiredDecision() { + return requiredDecisionRef.getReferenceTargetElement(this); + } + + public void setRequiredDecision(Decision requiredDecision) { + requiredDecisionRef.setReferenceTargetElement(this, requiredDecision); + } + + public InputData getRequiredInput() { + return requiredInputRef.getReferenceTargetElement(this); + } + + public void setRequiredInput(InputData requiredInput) { + requiredInputRef.setReferenceTargetElement(this, requiredInput); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(InformationRequirement.class, DMN_ELEMENT_INFORMATION_REQUIREMENT) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public InformationRequirement newInstance(ModelTypeInstanceContext instanceContext) { + return new InformationRequirementImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + requiredDecisionRef = sequenceBuilder.element(RequiredDecisionReference.class) + .uriElementReference(Decision.class) + .build(); + + requiredInputRef = sequenceBuilder.element(RequiredInputReference.class) + .uriElementReference(InputData.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputClauseImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputClauseImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..7942555f04820cd081d5c2a5cef54d666f1dc616 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputClauseImpl.java @@ -0,0 +1,103 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.CAMUNDA_ATTRIBUTE_INPUT_VARIABLE; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.CAMUNDA_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_INPUT_CLAUSE; + +import org.camunda.bpm.model.dmn.instance.DmnElement; +import org.camunda.bpm.model.dmn.instance.InputClause; +import org.camunda.bpm.model.dmn.instance.InputExpression; +import org.camunda.bpm.model.dmn.instance.InputValues; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class InputClauseImpl extends DmnElementImpl implements InputClause { + + protected static ChildElement inputExpressionChild; + protected static ChildElement inputValuesChild; + + // camunda extensions + protected static Attribute camundaInputVariableAttribute; + + public InputClauseImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public InputExpression getInputExpression() { + return inputExpressionChild.getChild(this); + } + + public void setInputExpression(InputExpression inputExpression) { + inputExpressionChild.setChild(this, inputExpression); + } + + public InputValues getInputValues() { + return inputValuesChild.getChild(this); + } + + public void setInputValues(InputValues inputValues) { + inputValuesChild.setChild(this, inputValues); + } + + // camunda extensions + + public String getCamundaInputVariable() { + return camundaInputVariableAttribute.getValue(this); + } + + + public void setCamundaInputVariable(String inputVariable) { + camundaInputVariableAttribute.setValue(this, inputVariable); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(InputClause.class, DMN_ELEMENT_INPUT_CLAUSE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public InputClause newInstance(ModelTypeInstanceContext instanceContext) { + return new InputClauseImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + inputExpressionChild = sequenceBuilder.element(InputExpression.class) + .required() + .build(); + + inputValuesChild = sequenceBuilder.element(InputValues.class) + .build(); + + // camunda extensions + + camundaInputVariableAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_INPUT_VARIABLE) + .namespace(CAMUNDA_NS) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputDataImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputDataImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..060527e28341af691583979f2e065dc1cb9ec6dd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputDataImpl.java @@ -0,0 +1,66 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_INPUT_DATA; + +import org.camunda.bpm.model.dmn.instance.DrgElement; +import org.camunda.bpm.model.dmn.instance.InformationItem; +import org.camunda.bpm.model.dmn.instance.InputData; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class InputDataImpl extends DrgElementImpl implements InputData { + + protected static ChildElement informationItemChild; + + public InputDataImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public InformationItem getInformationItem() { + return informationItemChild.getChild(this); + } + + public void setInformationItem(InformationItem informationItem) { + informationItemChild.setChild(this, informationItem); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(InputData.class, DMN_ELEMENT_INPUT_DATA) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DrgElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public InputData newInstance(ModelTypeInstanceContext instanceContext) { + return new InputDataImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + informationItemChild = sequenceBuilder.element(InformationItem.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputDataReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputDataReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..6411d55fa6da7113f4d89e601d3d8986ca936343 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputDataReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_INPUT_DATA_REFERENCE; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.InputDataReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class InputDataReferenceImpl extends DmnElementReferenceImpl implements InputDataReference { + + public InputDataReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(InputDataReference.class, DMN_ELEMENT_INPUT_DATA_REFERENCE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public InputDataReference newInstance(ModelTypeInstanceContext instanceContext) { + return new InputDataReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputDecisionReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputDecisionReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..65c929c9c567d2a10aa70d4162abd3a8044bb5aa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputDecisionReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_INPUT_DECISION_REFERENCE; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.InputDecisionReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class InputDecisionReferenceImpl extends DmnElementReferenceImpl implements InputDecisionReference { + + public InputDecisionReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(InputDecisionReference.class, DMN_ELEMENT_INPUT_DECISION_REFERENCE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public InputDecisionReference newInstance(ModelTypeInstanceContext instanceContext) { + return new InputDecisionReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputEntryImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputEntryImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9527b32deeb857905e2c215c8c71e90dd20c0908 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputEntryImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_INPUT_ENTRY; + +import org.camunda.bpm.model.dmn.instance.InputEntry; +import org.camunda.bpm.model.dmn.instance.UnaryTests; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class InputEntryImpl extends UnaryTestsImpl implements InputEntry { + + public InputEntryImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(InputEntry.class, DMN_ELEMENT_INPUT_ENTRY) + .namespaceUri(LATEST_DMN_NS) + .extendsType(UnaryTests.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public InputEntry newInstance(ModelTypeInstanceContext instanceContext) { + return new InputEntryImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputExpressionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputExpressionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..921d764133f9ef1598c578bb7f14eebf8aa8a35a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputExpressionImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_INPUT_EXPRESSION; + +import org.camunda.bpm.model.dmn.instance.InputExpression; +import org.camunda.bpm.model.dmn.instance.LiteralExpression; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class InputExpressionImpl extends LiteralExpressionImpl implements InputExpression { + + public InputExpressionImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(InputExpression.class, DMN_ELEMENT_INPUT_EXPRESSION) + .namespaceUri(LATEST_DMN_NS) + .extendsType(LiteralExpression.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public InputExpression newInstance(ModelTypeInstanceContext instanceContext) { + return new InputExpressionImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..40c97b08e37967d09366b5b104b8c318aaa90ba2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_INPUT; + +import org.camunda.bpm.model.dmn.instance.Input; +import org.camunda.bpm.model.dmn.instance.InputClause; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class InputImpl extends InputClauseImpl implements Input { + + public InputImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Input.class, DMN_ELEMENT_INPUT) + .namespaceUri(LATEST_DMN_NS) + .extendsType(InputClause.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Input newInstance(ModelTypeInstanceContext instanceContext) { + return new InputImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputValuesImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputValuesImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..d7502554bbafcb7c68dc0f2f771d25b50cdff694 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InputValuesImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_INPUT_VALUES; + +import org.camunda.bpm.model.dmn.instance.InputValues; +import org.camunda.bpm.model.dmn.instance.UnaryTests; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class InputValuesImpl extends UnaryTestsImpl implements InputValues { + + public InputValuesImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(InputValues.class, DMN_ELEMENT_INPUT_VALUES) + .namespaceUri(LATEST_DMN_NS) + .extendsType(UnaryTests.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public InputValues newInstance(ModelTypeInstanceContext instanceContext) { + return new InputValuesImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InvocationImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InvocationImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..8ae057f369e626eec88a2918d5658e33413e87ac --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/InvocationImpl.java @@ -0,0 +1,77 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_INVOCATION; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.Binding; +import org.camunda.bpm.model.dmn.instance.Expression; +import org.camunda.bpm.model.dmn.instance.Invocation; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class InvocationImpl extends ExpressionImpl implements Invocation { + + protected static ChildElement expressionChild; + protected static ChildElementCollection bindingCollection; + + public InvocationImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Expression getExpression() { + return expressionChild.getChild(this); + } + + public void setExpression(Expression expression) { + expressionChild.setChild(this, expression); + } + + public Collection getBindings() { + return bindingCollection.get(this); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Invocation.class, DMN_ELEMENT_INVOCATION) + .namespaceUri(LATEST_DMN_NS) + .extendsType(Expression.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Invocation newInstance(ModelTypeInstanceContext instanceContext) { + return new InvocationImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + expressionChild = sequenceBuilder.element(Expression.class) + .build(); + + bindingCollection = sequenceBuilder.elementCollection(Binding.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ItemComponentImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ItemComponentImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..32f0362ede228ea4ea91c6e7470536e7eece7fbd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ItemComponentImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_ITEM_COMPONENT; + +import org.camunda.bpm.model.dmn.instance.ItemComponent; +import org.camunda.bpm.model.dmn.instance.ItemDefinition; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class ItemComponentImpl extends ItemDefinitionImpl implements ItemComponent { + + public ItemComponentImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ItemComponent.class, DMN_ELEMENT_ITEM_COMPONENT) + .namespaceUri(LATEST_DMN_NS) + .extendsType(ItemDefinition.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public ItemComponent newInstance(ModelTypeInstanceContext instanceContext) { + return new ItemComponentImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ItemDefinitionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ItemDefinitionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..e96bd37ade911b68477a409509a0f6592e03ae89 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ItemDefinitionImpl.java @@ -0,0 +1,120 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_IS_COLLECTION; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_TYPE_LANGUAGE; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_ITEM_DEFINITION; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.AllowedValues; +import org.camunda.bpm.model.dmn.instance.ItemComponent; +import org.camunda.bpm.model.dmn.instance.ItemDefinition; +import org.camunda.bpm.model.dmn.instance.NamedElement; +import org.camunda.bpm.model.dmn.instance.TypeRef; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class ItemDefinitionImpl extends NamedElementImpl implements ItemDefinition { + + protected static Attribute typeLanguageAttribute; + protected static Attribute isCollectionAttribute; + + protected static ChildElement typeRefChild; + protected static ChildElement allowedValuesChild; + protected static ChildElementCollection itemComponentCollection; + + public ItemDefinitionImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getTypeLanguage() { + return typeLanguageAttribute.getValue(this); + } + + public void setTypeLanguage(String typeLanguage) { + typeLanguageAttribute.setValue(this, typeLanguage); + } + + public boolean isCollection() { + return isCollectionAttribute.getValue(this); + } + + public void setCollection(boolean isCollection) { + isCollectionAttribute.setValue(this, isCollection); + } + + public TypeRef getTypeRef() { + return typeRefChild.getChild(this); + } + + public void setTypeRef(TypeRef typeRef) { + typeRefChild.setChild(this, typeRef); + } + + public AllowedValues getAllowedValues() { + return allowedValuesChild.getChild(this); + } + + public void setAllowedValues(AllowedValues allowedValues) { + allowedValuesChild.setChild(this, allowedValues); + } + + public Collection getItemComponents() { + return itemComponentCollection.get(this); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ItemDefinition.class, DMN_ELEMENT_ITEM_DEFINITION) + .namespaceUri(LATEST_DMN_NS) + .extendsType(NamedElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public ItemDefinition newInstance(ModelTypeInstanceContext instanceContext) { + return new ItemDefinitionImpl(instanceContext); + } + }); + + typeLanguageAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_TYPE_LANGUAGE) + .build(); + + isCollectionAttribute = typeBuilder.booleanAttribute(DMN_ATTRIBUTE_IS_COLLECTION) + .defaultValue(false) + .build(); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + typeRefChild = sequenceBuilder.element(TypeRef.class) + .build(); + + allowedValuesChild = sequenceBuilder.element(AllowedValues.class) + .build(); + + itemComponentCollection = sequenceBuilder.elementCollection(ItemComponent.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ItemDefinitionReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ItemDefinitionReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fe43733141b5f9c057446c8ec5e582a89766cca7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ItemDefinitionReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_ITEM_DEFINITION_REFERENCE; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.ItemDefinitionReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class ItemDefinitionReferenceImpl extends DmnElementReferenceImpl implements ItemDefinitionReference { + + public ItemDefinitionReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ItemDefinitionReference.class, DMN_ELEMENT_ITEM_DEFINITION_REFERENCE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public ItemDefinitionReference newInstance(ModelTypeInstanceContext instanceContext) { + return new ItemDefinitionReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/KnowledgeRequirementImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/KnowledgeRequirementImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..733f8ab70dc0dbfa7a616ae9af5c96fcf8fa0b3a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/KnowledgeRequirementImpl.java @@ -0,0 +1,67 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_KNOWLEDGE_REQUIREMENT; + +import org.camunda.bpm.model.dmn.instance.BusinessKnowledgeModel; +import org.camunda.bpm.model.dmn.instance.KnowledgeRequirement; +import org.camunda.bpm.model.dmn.instance.RequiredKnowledgeReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReference; + +public class KnowledgeRequirementImpl extends DmnModelElementInstanceImpl implements KnowledgeRequirement { + + protected static ElementReference requiredKnowledgeRef; + + public KnowledgeRequirementImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public BusinessKnowledgeModel getRequiredKnowledge() { + return requiredKnowledgeRef.getReferenceTargetElement(this); + } + + public void setRequiredKnowledge(BusinessKnowledgeModel requiredKnowledge) { + requiredKnowledgeRef.setReferenceTargetElement(this, requiredKnowledge); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(KnowledgeRequirement.class, DMN_ELEMENT_KNOWLEDGE_REQUIREMENT) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public KnowledgeRequirement newInstance(ModelTypeInstanceContext instanceContext) { + return new KnowledgeRequirementImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + requiredKnowledgeRef = sequenceBuilder.element(RequiredKnowledgeReference.class) + .required() + .uriElementReference(BusinessKnowledgeModel.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/KnowledgeSourceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/KnowledgeSourceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..a56d99e4a21bb38ec9effe1bf1c993860055008e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/KnowledgeSourceImpl.java @@ -0,0 +1,109 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_LOCATION_URI; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_KNOWLEDGE_SOURCE; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.AuthorityRequirement; +import org.camunda.bpm.model.dmn.instance.DrgElement; +import org.camunda.bpm.model.dmn.instance.KnowledgeSource; +import org.camunda.bpm.model.dmn.instance.OrganizationUnit; +import org.camunda.bpm.model.dmn.instance.OwnerReference; +import org.camunda.bpm.model.dmn.instance.Type; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReference; + +public class KnowledgeSourceImpl extends DrgElementImpl implements KnowledgeSource { + + protected static Attribute locationUriAttribute; + + protected static ChildElementCollection authorityRequirementCollection; + protected static ChildElement typeChild; + protected static ElementReference ownerRef; + + public KnowledgeSourceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getLocationUri() { + return locationUriAttribute.getValue(this); + } + + public void setLocationUri(String locationUri) { + locationUriAttribute.setValue(this, locationUri); + } + + public Collection getAuthorityRequirement() { + return authorityRequirementCollection.get(this); + } + + public Type getType() { + return typeChild.getChild(this); + } + + public void setType(Type type) { + typeChild.setChild(this, type); + } + + public OrganizationUnit getOwner() { + return ownerRef.getReferenceTargetElement(this); + } + + public void setOwner(OrganizationUnit owner) { + ownerRef.setReferenceTargetElement(this, owner); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(KnowledgeSource.class, DMN_ELEMENT_KNOWLEDGE_SOURCE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DrgElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public KnowledgeSource newInstance(ModelTypeInstanceContext instanceContext) { + return new KnowledgeSourceImpl(instanceContext); + } + }); + + locationUriAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_LOCATION_URI) + .build(); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + authorityRequirementCollection = sequenceBuilder.elementCollection(AuthorityRequirement.class) + .build(); + + typeChild = sequenceBuilder.element(Type.class) + .build(); + + ownerRef = sequenceBuilder.element(OwnerReference.class) + .uriElementReference(OrganizationUnit.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ListImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ListImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..7fa604c6dbeedfa8abff2e5b4f39e8577a156d85 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ListImpl.java @@ -0,0 +1,63 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_LIST; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.Expression; +import org.camunda.bpm.model.dmn.instance.List; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class ListImpl extends ExpressionImpl implements List { + + protected static ChildElementCollection expressionCollection; + + public ListImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Collection getExpressions() { + return expressionCollection.get(this); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(List.class, DMN_ELEMENT_LIST) + .namespaceUri(LATEST_DMN_NS) + .extendsType(Expression.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public List newInstance(ModelTypeInstanceContext instanceContext) { + return new ListImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + expressionCollection = sequenceBuilder.elementCollection(Expression.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/LiteralExpressionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/LiteralExpressionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..ae994efb62e626be848739a3dd5f1e2a0c52a37a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/LiteralExpressionImpl.java @@ -0,0 +1,94 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_EXPRESSION_LANGUAGE; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_LITERAL_EXPRESSION; + +import org.camunda.bpm.model.dmn.instance.Expression; +import org.camunda.bpm.model.dmn.instance.ImportedValues; +import org.camunda.bpm.model.dmn.instance.LiteralExpression; +import org.camunda.bpm.model.dmn.instance.Text; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class LiteralExpressionImpl extends ExpressionImpl implements LiteralExpression { + + protected static Attribute expressionLanguageAttribute; + + protected static ChildElement textChild; + protected static ChildElement importedValuesChild; + + public LiteralExpressionImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getExpressionLanguage() { + return expressionLanguageAttribute.getValue(this); + } + + public void setExpressionLanguage(String expressionLanguage) { + expressionLanguageAttribute.setValue(this, expressionLanguage); + } + + public Text getText() { + return textChild.getChild(this); + } + + public void setText(Text text) { + textChild.setChild(this, text); + } + + public ImportedValues getImportValues() { + return importedValuesChild.getChild(this); + } + + public void setImportValues(ImportedValues importedValues) { + importedValuesChild.setChild(this, importedValues); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(LiteralExpression.class, DMN_ELEMENT_LITERAL_EXPRESSION) + .namespaceUri(LATEST_DMN_NS) + .extendsType(Expression.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public LiteralExpression newInstance(ModelTypeInstanceContext instanceContext) { + return new LiteralExpressionImpl(instanceContext); + } + }); + + expressionLanguageAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_EXPRESSION_LANGUAGE) + .build(); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + textChild = sequenceBuilder.element(Text.class) + .build(); + + importedValuesChild = sequenceBuilder.element(ImportedValues.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/NamedElementImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/NamedElementImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0ab3127ac3f169a1094f29f43285b51f1c8568db --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/NamedElementImpl.java @@ -0,0 +1,59 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_NAME; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_NAMED_ELEMENT; + +import org.camunda.bpm.model.dmn.instance.DmnElement; +import org.camunda.bpm.model.dmn.instance.NamedElement; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.attribute.Attribute; + +public abstract class NamedElementImpl extends DmnElementImpl implements NamedElement { + + protected static Attribute nameAttribute; + + public NamedElementImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getName() { + return nameAttribute.getValue(this); + } + + public void setName(String name) { + nameAttribute.setValue(this, name); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(NamedElement.class, DMN_ELEMENT_NAMED_ELEMENT) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElement.class) + .abstractType(); + + nameAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_NAME) + .required() + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OrganizationUnitImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OrganizationUnitImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0cfcfcff019940db399b7e293f484e8206a5fb77 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OrganizationUnitImpl.java @@ -0,0 +1,76 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_ORGANIZATION_UNIT; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.BusinessContextElement; +import org.camunda.bpm.model.dmn.instance.Decision; +import org.camunda.bpm.model.dmn.instance.DecisionMadeReference; +import org.camunda.bpm.model.dmn.instance.DecisionOwnedReference; +import org.camunda.bpm.model.dmn.instance.OrganizationUnit; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollection; + +public class OrganizationUnitImpl extends BusinessContextElementImpl implements OrganizationUnit { + + protected static ElementReferenceCollection decisionDecisionMadeRefCollection; + protected static ElementReferenceCollection decisionDecisionOwnedRefCollection; + + public OrganizationUnitImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Collection getDecisionsMade() { + return decisionDecisionMadeRefCollection.getReferenceTargetElements(this); + } + + public Collection getDecisionsOwned() { + return decisionDecisionOwnedRefCollection.getReferenceTargetElements(this); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(OrganizationUnit.class, DMN_ELEMENT_ORGANIZATION_UNIT) + .namespaceUri(LATEST_DMN_NS) + .extendsType(BusinessContextElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public OrganizationUnit newInstance(ModelTypeInstanceContext instanceContext) { + return new OrganizationUnitImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + decisionDecisionMadeRefCollection = sequenceBuilder.elementCollection(DecisionMadeReference.class) + .uriElementReferenceCollection(Decision.class) + .build(); + + decisionDecisionOwnedRefCollection = sequenceBuilder.elementCollection(DecisionOwnedReference.class) + .uriElementReferenceCollection(Decision.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputClauseImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputClauseImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..dcbcdd87c1d0a79097689c3adf8081f7eb9d7135 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputClauseImpl.java @@ -0,0 +1,107 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_NAME; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_TYPE_REF; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_OUTPUT_CLAUSE; + +import org.camunda.bpm.model.dmn.instance.DefaultOutputEntry; +import org.camunda.bpm.model.dmn.instance.DmnElement; +import org.camunda.bpm.model.dmn.instance.OutputClause; +import org.camunda.bpm.model.dmn.instance.OutputValues; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class OutputClauseImpl extends DmnElementImpl implements OutputClause { + + protected static Attribute nameAttribute; + protected static Attribute typeRefAttribute; + + protected static ChildElement outputValuesChild; + protected static ChildElement defaultOutputEntryChild; + + public OutputClauseImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getName() { + return nameAttribute.getValue(this); + } + + public void setName(String name) { + nameAttribute.setValue(this, name); + } + + public String getTypeRef() { + return typeRefAttribute.getValue(this); + } + + public void setTypeRef(String typeRef) { + typeRefAttribute.setValue(this, typeRef); + } + + public OutputValues getOutputValues() { + return outputValuesChild.getChild(this); + } + + public void setOutputValues(OutputValues outputValues) { + outputValuesChild.setChild(this, outputValues); + } + + public DefaultOutputEntry getDefaultOutputEntry() { + return defaultOutputEntryChild.getChild(this); + } + + public void setDefaultOutputEntry(DefaultOutputEntry defaultOutputEntry) { + defaultOutputEntryChild.setChild(this, defaultOutputEntry); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(OutputClause.class, DMN_ELEMENT_OUTPUT_CLAUSE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public OutputClause newInstance(ModelTypeInstanceContext instanceContext) { + return new OutputClauseImpl(instanceContext); + } + }); + + nameAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_NAME) + .build(); + + typeRefAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_TYPE_REF) + .build(); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + outputValuesChild = sequenceBuilder.element(OutputValues.class) + .build(); + + defaultOutputEntryChild = sequenceBuilder.element(DefaultOutputEntry.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputDecisionReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputDecisionReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..2ef70faa2390b1a023ec799f53d2315e8311311a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputDecisionReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_OUTPUT_DECISION_REFERENCE; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.OutputDecisionReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class OutputDecisionReferenceImpl extends DmnElementReferenceImpl implements OutputDecisionReference { + + public OutputDecisionReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(OutputDecisionReference.class, DMN_ELEMENT_OUTPUT_DECISION_REFERENCE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public OutputDecisionReference newInstance(ModelTypeInstanceContext instanceContext) { + return new OutputDecisionReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputEntryImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputEntryImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..7dc2f64e38c6b72a6ee881850ba91bc02696e912 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputEntryImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_OUTPUT_ENTRY; + +import org.camunda.bpm.model.dmn.instance.LiteralExpression; +import org.camunda.bpm.model.dmn.instance.OutputEntry; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class OutputEntryImpl extends LiteralExpressionImpl implements OutputEntry { + + public OutputEntryImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(OutputEntry.class, DMN_ELEMENT_OUTPUT_ENTRY) + .namespaceUri(LATEST_DMN_NS) + .extendsType(LiteralExpression.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public OutputEntry newInstance(ModelTypeInstanceContext instanceContext) { + return new OutputEntryImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..edf787c590dc45b39b4b8cd31cdd061766678251 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_OUTPUT; + +import org.camunda.bpm.model.dmn.instance.Output; +import org.camunda.bpm.model.dmn.instance.OutputClause; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class OutputImpl extends OutputClauseImpl implements Output { + + public OutputImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Output.class, DMN_ELEMENT_OUTPUT) + .namespaceUri(LATEST_DMN_NS) + .extendsType(OutputClause.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Output newInstance(ModelTypeInstanceContext instanceContext) { + return new OutputImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputValuesImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputValuesImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..e738468e3f90506f6a03012678ba3c216d0fe70f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OutputValuesImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_OUTPUT_VALUES; + +import org.camunda.bpm.model.dmn.instance.OutputValues; +import org.camunda.bpm.model.dmn.instance.UnaryTests; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class OutputValuesImpl extends UnaryTestsImpl implements OutputValues { + + public OutputValuesImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(OutputValues.class, DMN_ELEMENT_OUTPUT_VALUES) + .namespaceUri(LATEST_DMN_NS) + .extendsType(UnaryTests.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public OutputValues newInstance(ModelTypeInstanceContext instanceContext) { + return new OutputValuesImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OwnerReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OwnerReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..b651ef00629f61bbbf0d033dc3329f77c6cedf75 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/OwnerReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_OWNER; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.OwnerReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class OwnerReferenceImpl extends DmnElementReferenceImpl implements OwnerReference { + + public OwnerReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(OwnerReference.class, DMN_ELEMENT_OWNER) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public OwnerReference newInstance(ModelTypeInstanceContext instanceContext) { + return new OwnerReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ParameterImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ParameterImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..7d9158f0b9f437e3b413ac65c7ae6e549e070807 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/ParameterImpl.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_PARAMETER; + +import org.camunda.bpm.model.dmn.instance.InformationItem; +import org.camunda.bpm.model.dmn.instance.Parameter; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class ParameterImpl extends InformationItemImpl implements Parameter { + + public ParameterImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Parameter.class, DMN_ELEMENT_PARAMETER) + .namespaceUri(LATEST_DMN_NS) + .extendsType(InformationItem.class) + .instanceProvider(new ModelTypeInstanceProvider() { + @Override + public Parameter newInstance(ModelTypeInstanceContext instanceContext) { + return new ParameterImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/PerformanceIndicatorImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/PerformanceIndicatorImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..7d01a17e5a95b82f69c0a8e17c7186d8b10ada7b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/PerformanceIndicatorImpl.java @@ -0,0 +1,66 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_PERFORMANCE_INDICATOR; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.BusinessContextElement; +import org.camunda.bpm.model.dmn.instance.Decision; +import org.camunda.bpm.model.dmn.instance.ImpactingDecisionReference; +import org.camunda.bpm.model.dmn.instance.PerformanceIndicator; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollection; + +public class PerformanceIndicatorImpl extends BusinessContextElementImpl implements PerformanceIndicator { + + protected static ElementReferenceCollection impactingDecisionRefCollection; + + public PerformanceIndicatorImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Collection getImpactingDecisions() { + return impactingDecisionRefCollection.getReferenceTargetElements(this); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(PerformanceIndicator.class, DMN_ELEMENT_PERFORMANCE_INDICATOR) + .namespaceUri(LATEST_DMN_NS) + .extendsType(BusinessContextElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public PerformanceIndicator newInstance(ModelTypeInstanceContext instanceContext) { + return new PerformanceIndicatorImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + impactingDecisionRefCollection = sequenceBuilder.elementCollection(ImpactingDecisionReference.class) + .uriElementReferenceCollection(Decision.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/QuestionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/QuestionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..71350953dff076ab2a1eb8abd8d7749263299dee --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/QuestionImpl.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_QUESTION; + +import org.camunda.bpm.model.dmn.instance.Question; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class QuestionImpl extends DmnModelElementInstanceImpl implements Question { + + public QuestionImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Question.class, DMN_ELEMENT_QUESTION) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public Question newInstance(ModelTypeInstanceContext instanceContext) { + return new QuestionImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RelationImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RelationImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..440aaf0e4146e2d100b544d12d7a800e89139f21 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RelationImpl.java @@ -0,0 +1,73 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_RELATION; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.Column; +import org.camunda.bpm.model.dmn.instance.Expression; +import org.camunda.bpm.model.dmn.instance.Relation; +import org.camunda.bpm.model.dmn.instance.Row; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class RelationImpl extends ExpressionImpl implements Relation { + + protected static ChildElementCollection columnCollection; + protected static ChildElementCollection rowCollection; + + public RelationImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Collection getColumns() { + return columnCollection.get(this); + } + + public Collection getRows() { + return rowCollection.get(this); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Relation.class, DMN_ELEMENT_RELATION) + .namespaceUri(LATEST_DMN_NS) + .extendsType(Expression.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Relation newInstance(ModelTypeInstanceContext instanceContext) { + return new RelationImpl(instanceContext); + } + }); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + columnCollection = sequenceBuilder.elementCollection(Column.class) + .build(); + + rowCollection = sequenceBuilder.elementCollection(Row.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RequiredAuthorityReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RequiredAuthorityReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..a851b93dc99ed85a4b95a8b2efff12a4d1678600 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RequiredAuthorityReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_REQUIRED_AUTHORITY; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.RequiredAuthorityReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class RequiredAuthorityReferenceImpl extends DmnElementReferenceImpl implements RequiredAuthorityReference { + + public RequiredAuthorityReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(RequiredAuthorityReference.class, DMN_ELEMENT_REQUIRED_AUTHORITY) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public RequiredAuthorityReference newInstance(ModelTypeInstanceContext instanceContext) { + return new RequiredAuthorityReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RequiredDecisionReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RequiredDecisionReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0897116f380549493a4bbfa3f4eb3ed97c34c0b3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RequiredDecisionReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_REQUIRED_DECISION; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.RequiredDecisionReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class RequiredDecisionReferenceImpl extends DmnElementReferenceImpl implements org.camunda.bpm.model.dmn.instance.RequiredDecisionReference { + + public RequiredDecisionReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(RequiredDecisionReference.class, DMN_ELEMENT_REQUIRED_DECISION) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public RequiredDecisionReference newInstance(ModelTypeInstanceContext instanceContext) { + return new RequiredDecisionReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RequiredInputReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RequiredInputReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..076cc92fa43524cb8d1e640af1435a6be781679f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RequiredInputReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_REQUIRED_INPUT; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.RequiredInputReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class RequiredInputReferenceImpl extends DmnElementReferenceImpl implements RequiredInputReference { + + public RequiredInputReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(RequiredInputReference.class, DMN_ELEMENT_REQUIRED_INPUT) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public RequiredInputReference newInstance(ModelTypeInstanceContext instanceContext) { + return new RequiredInputReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RequiredKnowledgeReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RequiredKnowledgeReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..aeb4164da93357fc1fb834859072ab986f0e7bab --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RequiredKnowledgeReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_REQUIRED_KNOWLEDGE; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.RequiredKnowledgeReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class RequiredKnowledgeReferenceImpl extends DmnElementReferenceImpl implements RequiredKnowledgeReference { + + public RequiredKnowledgeReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(RequiredKnowledgeReference.class, DMN_ELEMENT_REQUIRED_KNOWLEDGE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public RequiredKnowledgeReference newInstance(ModelTypeInstanceContext instanceContext) { + return new RequiredKnowledgeReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RowImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RowImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..8149f8c0e1b6549a59db5ccf4b7019cdfc5cc71e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RowImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_ROW; + +import org.camunda.bpm.model.dmn.instance.List; +import org.camunda.bpm.model.dmn.instance.Row; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class RowImpl extends ListImpl implements Row { + + public RowImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Row.class, DMN_ELEMENT_ROW) + .namespaceUri(LATEST_DMN_NS) + .extendsType(List.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Row newInstance(ModelTypeInstanceContext instanceContext) { + return new RowImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RuleImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RuleImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..dae7f43d0fb3445e044358e5c90b0abb98be2814 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/RuleImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_RULE; + +import org.camunda.bpm.model.dmn.instance.DecisionRule; +import org.camunda.bpm.model.dmn.instance.Rule; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class RuleImpl extends DecisionRuleImpl implements Rule { + + public RuleImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Rule.class, DMN_ELEMENT_RULE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DecisionRule.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Rule newInstance(ModelTypeInstanceContext instanceContext) { + return new RuleImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/SourceRefImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/SourceRefImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..3cc5ca5e114e18400045580469396cb3d96d5df8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/SourceRefImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_SOURCE_REF; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.SourceRef; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class SourceRefImpl extends DmnElementReferenceImpl implements SourceRef { + + public SourceRefImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(SourceRef.class, DMN_ELEMENT_SOURCE_REF) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public SourceRef newInstance(ModelTypeInstanceContext instanceContext) { + return new SourceRefImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/SupportedObjectiveReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/SupportedObjectiveReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..776a6e21d7b1b13b615a052cd1da1957d65e93b3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/SupportedObjectiveReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_SUPPORTED_OBJECT; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.SupportedObjectiveReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class SupportedObjectiveReferenceImpl extends DmnElementReferenceImpl implements SupportedObjectiveReference { + + public SupportedObjectiveReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(SupportedObjectiveReference.class, DMN_ELEMENT_SUPPORTED_OBJECT) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public SupportedObjectiveReference newInstance(ModelTypeInstanceContext instanceContext) { + return new SupportedObjectiveReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TargetRefImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TargetRefImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..880be41ec98812efd36c5826eac113808f9352f2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TargetRefImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_TARGET_REF; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.TargetRef; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class TargetRefImpl extends DmnElementReferenceImpl implements TargetRef { + + public TargetRefImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(TargetRef.class, DMN_ELEMENT_TARGET_REF) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public TargetRef newInstance(ModelTypeInstanceContext instanceContext) { + return new TargetRefImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TextAnnotationImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TextAnnotationImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..1e44d9994e18912c05ca26071d86ba87251c7407 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TextAnnotationImpl.java @@ -0,0 +1,82 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_TEXT_FORMAT; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_TEXT_ANNOTATION; + +import org.camunda.bpm.model.dmn.instance.Artifact; +import org.camunda.bpm.model.dmn.instance.Text; +import org.camunda.bpm.model.dmn.instance.TextAnnotation; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class TextAnnotationImpl extends ArtifactImpl implements TextAnnotation { + + protected static Attribute textFormatAttribute; + + protected static ChildElement textChild; + + public String getTextFormat() { + return textFormatAttribute.getValue(this); + } + + public void setTextFormat(String textFormat) { + textFormatAttribute.setValue(this, textFormat); + } + + public Text getText() { + return textChild.getChild(this); + } + + public void setText(Text text) { + textChild.setChild(this, text); + } + + public TextAnnotationImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(TextAnnotation.class, DMN_ELEMENT_TEXT_ANNOTATION) + .namespaceUri(LATEST_DMN_NS) + .extendsType(Artifact.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public TextAnnotation newInstance(ModelTypeInstanceContext instanceContext) { + return new TextAnnotationImpl(instanceContext); + } + }); + + textFormatAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_TEXT_FORMAT) + .defaultValue("text/plain") + .build(); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + textChild = sequenceBuilder.element(Text.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TextImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TextImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..832aae3b0ddabec20e24eee9c41d9be8f00421ef --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TextImpl.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_TEXT; + +import org.camunda.bpm.model.dmn.instance.Text; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class TextImpl extends DmnModelElementInstanceImpl implements Text { + + public TextImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Text.class, DMN_ELEMENT_TEXT) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public Text newInstance(ModelTypeInstanceContext instanceContext) { + return new TextImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TypeImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TypeImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..cd1efd4ab9347b3697462cda65d620afd4998c41 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TypeImpl.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_TYPE; + +import org.camunda.bpm.model.dmn.instance.Type; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class TypeImpl extends DmnModelElementInstanceImpl implements Type { + + public TypeImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Type.class, DMN_ELEMENT_TYPE) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public Type newInstance(ModelTypeInstanceContext instanceContext) { + return new TypeImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TypeRefImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TypeRefImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..cb1e19615a60236d73db55ea64a7c07257a8c7c6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/TypeRefImpl.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_TYPE_REF; + +import org.camunda.bpm.model.dmn.instance.TypeRef; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class TypeRefImpl extends DmnModelElementInstanceImpl implements TypeRef { + + public TypeRefImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(TypeRef.class, DMN_ELEMENT_TYPE_REF) + .namespaceUri(LATEST_DMN_NS) + .instanceProvider(new ModelTypeInstanceProvider() { + public TypeRef newInstance(ModelTypeInstanceContext instanceContext) { + return new TypeRefImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/UnaryTestsImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/UnaryTestsImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..14dcc9a830ac26bad2d03c8d316ce59d8c3e88fa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/UnaryTestsImpl.java @@ -0,0 +1,81 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ATTRIBUTE_EXPRESSION_LANGUAGE; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_UNARY_TESTS; + +import org.camunda.bpm.model.dmn.instance.DmnElement; +import org.camunda.bpm.model.dmn.instance.Text; +import org.camunda.bpm.model.dmn.instance.UnaryTests; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +public class UnaryTestsImpl extends DmnElementImpl implements UnaryTests { + + protected static Attribute expressionLanguageAttribute; + + protected static ChildElement textChild; + + public UnaryTestsImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getExpressionLanguage() { + return expressionLanguageAttribute.getValue(this); + } + + public void setExpressionLanguage(String expressionLanguage) { + expressionLanguageAttribute.setValue(this, expressionLanguage); + } + + public Text getText() { + return textChild.getChild(this); + } + + public void setText(Text text) { + textChild.setChild(this, text); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(UnaryTests.class, DMN_ELEMENT_UNARY_TESTS) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElement.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public UnaryTests newInstance(ModelTypeInstanceContext instanceContext) { + return new UnaryTestsImpl(instanceContext); + } + }); + + expressionLanguageAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_EXPRESSION_LANGUAGE) + .build(); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + textChild = sequenceBuilder.element(Text.class) + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/UsingProcessReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/UsingProcessReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..86e4b274c59e11c16611ec9858f8be0720f040e6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/UsingProcessReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_USING_PROCESS; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.UsingProcessReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class UsingProcessReferenceImpl extends DmnElementReferenceImpl implements UsingProcessReference { + + public UsingProcessReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(UsingProcessReference.class, DMN_ELEMENT_USING_PROCESS) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public UsingProcessReference newInstance(ModelTypeInstanceContext instanceContext) { + return new UsingProcessReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/UsingTaskReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/UsingTaskReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..dfbdf96a36064ad4c8d444f3283dcb09d9c4fd00 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/UsingTaskReferenceImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_USING_TASK; + +import org.camunda.bpm.model.dmn.instance.DmnElementReference; +import org.camunda.bpm.model.dmn.instance.UsingTaskReference; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class UsingTaskReferenceImpl extends DmnElementReferenceImpl implements UsingTaskReference { + + public UsingTaskReferenceImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(UsingTaskReference.class, DMN_ELEMENT_USING_TASK) + .namespaceUri(LATEST_DMN_NS) + .extendsType(DmnElementReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public UsingTaskReference newInstance(ModelTypeInstanceContext instanceContext) { + return new UsingTaskReferenceImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/VariableImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/VariableImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..f9896fd9557f705783d617f751f9b9924118836c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/VariableImpl.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.impl.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_VARIABLE; + +import org.camunda.bpm.model.dmn.instance.InformationItem; +import org.camunda.bpm.model.dmn.instance.Variable; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class VariableImpl extends InformationItemImpl implements Variable { + + public VariableImpl(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Variable.class, DMN_ELEMENT_VARIABLE) + .namespaceUri(LATEST_DMN_NS) + .extendsType(InformationItem.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Variable newInstance(ModelTypeInstanceContext instanceContext) { + return new VariableImpl(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/AllowedAnswers.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/AllowedAnswers.java new file mode 100644 index 0000000000000000000000000000000000000000..0d947ce0cd8fd6dfc24f2feb111ad478ae8f852c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/AllowedAnswers.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface AllowedAnswers extends DmnModelElementInstance { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/AllowedValues.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/AllowedValues.java new file mode 100644 index 0000000000000000000000000000000000000000..f8866ecb0a07fe65f01c239065e1788f6207c583 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/AllowedValues.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface AllowedValues extends UnaryTests { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Artifact.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Artifact.java new file mode 100644 index 0000000000000000000000000000000000000000..b7569d3c6412c3ff2e04450952bc01a85be9795a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Artifact.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Artifact extends DmnElement { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Association.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Association.java new file mode 100644 index 0000000000000000000000000000000000000000..e46145d7f0dd5ba1563def46f5941e87a7c16b85 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Association.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import org.camunda.bpm.model.dmn.AssociationDirection; + +public interface Association extends Artifact { + + AssociationDirection getAssociationDirection(); + + void setAssociationDirection(AssociationDirection associationDirection); + + DmnElement getSource(); + + void setSource(DmnElement source); + + DmnElement getTarget(); + + void setTarget(DmnElement target); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/AuthorityRequirement.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/AuthorityRequirement.java new file mode 100644 index 0000000000000000000000000000000000000000..f0137bfc79db68706d73057d74ef185edfd83e11 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/AuthorityRequirement.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface AuthorityRequirement extends DmnModelElementInstance { + + Decision getRequiredDecision(); + + void setRequiredDecision(Decision requiredDecision); + + InputData getRequiredInput(); + + void setRequiredInput(InputData requiredInput); + + KnowledgeSource getRequiredAuthority(); + + void setRequiredAuthority(KnowledgeSource requiredAuthority); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Binding.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Binding.java new file mode 100644 index 0000000000000000000000000000000000000000..66c1ebe49a9e23d4e45980e1de6fa137ec7311a0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Binding.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Binding extends DmnModelElementInstance { + + Parameter getParameter(); + + void setParameter(Parameter parameter); + + Expression getExpression(); + + void setExpression(Expression expression); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/BusinessContextElement.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/BusinessContextElement.java new file mode 100644 index 0000000000000000000000000000000000000000..dd43deb99b67de5b58160d23feb685402d428490 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/BusinessContextElement.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface BusinessContextElement extends NamedElement { + + String getUri(); + + void setUri(String uri); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/BusinessKnowledgeModel.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/BusinessKnowledgeModel.java new file mode 100644 index 0000000000000000000000000000000000000000..0f559fa968d8e0368b131afaf4d7201b87f74c8c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/BusinessKnowledgeModel.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface BusinessKnowledgeModel extends DrgElement { + + EncapsulatedLogic getEncapsulatedLogic(); + + void setEncapsulatedLogic(EncapsulatedLogic encapsulatedLogic); + + Variable getVariable(); + + void setVariable(Variable variable); + + Collection getKnowledgeRequirement(); + + Collection getAuthorityRequirement(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Column.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Column.java new file mode 100644 index 0000000000000000000000000000000000000000..57734bea330ba823eb6b43b33b4b51067158ac1a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Column.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Column extends InformationItem { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Context.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Context.java new file mode 100644 index 0000000000000000000000000000000000000000..55f860fea4396914e1e5e5ffc8359319a063242a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Context.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface Context extends Expression { + + Collection getContextEntries(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ContextEntry.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ContextEntry.java new file mode 100644 index 0000000000000000000000000000000000000000..0fc625b3c9d2bbd6f194363b241e9385126aa279 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ContextEntry.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface ContextEntry extends DmnModelElementInstance { + + Variable getVariable(); + + void setVariable(Variable variable); + + Expression getExpression(); + + void setExpression(Expression expression); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Decision.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Decision.java new file mode 100644 index 0000000000000000000000000000000000000000..e9f64d252ffc224c116e3d5177e95f80dedd7e52 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Decision.java @@ -0,0 +1,72 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface Decision extends DrgElement { + + Question getQuestion(); + + void setQuestion(Question question); + + AllowedAnswers getAllowedAnswers(); + + void setAllowedAnswers(AllowedAnswers allowedAnswers); + + Variable getVariable(); + + void setVariable(Variable variable); + + Collection getInformationRequirements(); + + Collection getKnowledgeRequirements(); + + Collection getAuthorityRequirements(); + + Collection getSupportedObjectiveReferences(); + + Collection getImpactedPerformanceIndicators(); + + Collection getDecisionMakers(); + + Collection getDecisionOwners(); + + Collection getUsingProcessReferences(); + + Collection getUsingTaskReferences(); + + Expression getExpression(); + + void setExpression(Expression expression); + + // camunda extensions + + @Deprecated + Integer getCamundaHistoryTimeToLive(); + + @Deprecated + void setCamundaHistoryTimeToLive(Integer historyTimeToLive); + + String getCamundaHistoryTimeToLiveString(); + + void setCamundaHistoryTimeToLiveString(String historyTimeToLive); + + String getVersionTag(); + + void setVersionTag(String inputValue); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionMadeReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionMadeReference.java new file mode 100644 index 0000000000000000000000000000000000000000..f8e0880550f7061b98f749a54d37e20bc0aeea37 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionMadeReference.java @@ -0,0 +1,20 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface DecisionMadeReference extends DmnElementReference { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionMakerReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionMakerReference.java new file mode 100644 index 0000000000000000000000000000000000000000..28ec9aaf299b78cb437192e565b558a1c4d795a4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionMakerReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface DecisionMakerReference extends DmnElementReference{ + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionOwnedReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionOwnedReference.java new file mode 100644 index 0000000000000000000000000000000000000000..99185b81a6398d06feffd75a270f526e94e04af4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionOwnedReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface DecisionOwnedReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionOwnerReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionOwnerReference.java new file mode 100644 index 0000000000000000000000000000000000000000..2f4eb675026bd436b2dc712947235bd8bd025fc3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionOwnerReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface DecisionOwnerReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionRule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionRule.java new file mode 100644 index 0000000000000000000000000000000000000000..82bbed67c262e8111cd239b53bf1f3fa46b96958 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionRule.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface DecisionRule extends DmnElement { + + Collection getInputEntries(); + + Collection getOutputEntries(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionService.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionService.java new file mode 100644 index 0000000000000000000000000000000000000000..5812c3fad78a7b829067c400870595e284a6a935 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionService.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface DecisionService extends NamedElement { + + Collection getOutputDecisions(); + + Collection getEncapsulatedDecisions(); + + Collection getInputDecisions(); + + Collection getInputData(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionTable.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionTable.java new file mode 100644 index 0000000000000000000000000000000000000000..eb816555af7ac1527b64434709129336c38517e5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DecisionTable.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.BuiltinAggregator; +import org.camunda.bpm.model.dmn.DecisionTableOrientation; +import org.camunda.bpm.model.dmn.HitPolicy; + +public interface DecisionTable extends Expression { + + HitPolicy getHitPolicy(); + + void setHitPolicy(HitPolicy hitPolicy); + + BuiltinAggregator getAggregation(); + + void setAggregation(BuiltinAggregator aggregation); + + DecisionTableOrientation getPreferredOrientation(); + + void setPreferredOrientation(DecisionTableOrientation preferredOrientation); + + String getOutputLabel(); + + void setOutputLabel(String outputLabel); + + Collection getInputs(); + + Collection getOutputs(); + + Collection getRules(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DefaultOutputEntry.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DefaultOutputEntry.java new file mode 100644 index 0000000000000000000000000000000000000000..580a0bd318fa5f2b5f35aab6706a7a3d28fa6385 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DefaultOutputEntry.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface DefaultOutputEntry extends LiteralExpression { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Definitions.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Definitions.java new file mode 100644 index 0000000000000000000000000000000000000000..782368e91e0d49b60f4112c13c83945111c93c0f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Definitions.java @@ -0,0 +1,55 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface Definitions extends NamedElement { + + String getExpressionLanguage(); + + void setExpressionLanguage(String expressionLanguage); + + String getTypeLanguage(); + + void setTypeLanguage(String typeLanguage); + + String getNamespace(); + + void setNamespace(String namespace); + + String getExporter(); + + void setExporter(String exporter); + + String getExporterVersion(); + + void setExporterVersion(String exporterVersion); + + Collection getImports(); + + Collection getItemDefinitions(); + + Collection getArtifacts(); + + Collection getDrgElements(); + + Collection getElementCollections(); + + Collection getBusinessContextElements(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Description.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Description.java new file mode 100644 index 0000000000000000000000000000000000000000..52e4c63d07c719bb9835577777d067a2e79184b8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Description.java @@ -0,0 +1,20 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Description extends DmnModelElementInstance { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DmnElement.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DmnElement.java new file mode 100644 index 0000000000000000000000000000000000000000..d70d1f94c746e5b0e4bcbe080167490de0e74e2d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DmnElement.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface DmnElement extends DmnModelElementInstance { + + String getId(); + + void setId(String id); + + String getLabel(); + + void setLabel(String label); + + Description getDescription(); + + void setDescription(Description description); + + ExtensionElements getExtensionElements(); + + void setExtensionElements(ExtensionElements extensionElements); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DmnElementReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DmnElementReference.java new file mode 100644 index 0000000000000000000000000000000000000000..8d7d9b8a62657a44f9c6bcfacb7a0b9e6cfbdd8f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DmnElementReference.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface DmnElementReference extends DmnModelElementInstance { + + String getHref(); + + void setHref(String href); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DmnModelElementInstance.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DmnModelElementInstance.java new file mode 100644 index 0000000000000000000000000000000000000000..4a3609db57ff8ff68887ad0d2c8e97e0217d712f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DmnModelElementInstance.java @@ -0,0 +1,22 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +public interface DmnModelElementInstance extends ModelElementInstance { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DrgElement.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DrgElement.java new file mode 100644 index 0000000000000000000000000000000000000000..b9f30440c273653fc0a6d76c3011d98c406b9344 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DrgElement.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface DrgElement extends NamedElement { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DrgElementReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DrgElementReference.java new file mode 100644 index 0000000000000000000000000000000000000000..e35e12fa5ebc386bd4c14ba6a28b7f15b5c4fb49 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/DrgElementReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface DrgElementReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ElementCollection.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ElementCollection.java new file mode 100644 index 0000000000000000000000000000000000000000..118da2a4302696fac93711e7f079c911d8f46b45 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ElementCollection.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface ElementCollection extends NamedElement { + + Collection getDrgElements(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/EncapsulatedDecisionReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/EncapsulatedDecisionReference.java new file mode 100644 index 0000000000000000000000000000000000000000..1ea0652919339a6ec211d7315d3ff6ef5a47fa86 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/EncapsulatedDecisionReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface EncapsulatedDecisionReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/EncapsulatedLogic.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/EncapsulatedLogic.java new file mode 100644 index 0000000000000000000000000000000000000000..8e77e79ec363215cbf0ea8ac1392903c55467d9c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/EncapsulatedLogic.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface EncapsulatedLogic extends FunctionDefinition { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Expression.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Expression.java new file mode 100644 index 0000000000000000000000000000000000000000..9fdba53a70cc62ae16b03c7739f21a415d82138d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Expression.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Expression extends DmnElement { + + String getTypeRef(); + + void setTypeRef(String typeRef); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ExtensionElements.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ExtensionElements.java new file mode 100644 index 0000000000000000000000000000000000000000..33b9a5ef4ad56be2f1892cd918448a180f0cee2a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ExtensionElements.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +import org.camunda.bpm.model.dmn.Query; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * The DMN extensionElements element + */ +public interface ExtensionElements extends DmnModelElementInstance { + + Collection getElements(); + + Query getElementsQuery(); + + ModelElementInstance addExtensionElement(String namespaceUri, String localName); + + T addExtensionElement(Class extensionElementClass); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/FormalParameter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/FormalParameter.java new file mode 100644 index 0000000000000000000000000000000000000000..e972a0722725230e32db521a9aa1bbac79e48aad --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/FormalParameter.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface FormalParameter extends InformationItem { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/FunctionDefinition.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/FunctionDefinition.java new file mode 100644 index 0000000000000000000000000000000000000000..d79ad485e3a4ce3e92cd6e5e61b2f535c4911145 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/FunctionDefinition.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface FunctionDefinition extends Expression { + + Collection getFormalParameters(); + + Expression getExpression(); + + void setExpression(Expression expression); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ImpactedPerformanceIndicatorReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ImpactedPerformanceIndicatorReference.java new file mode 100644 index 0000000000000000000000000000000000000000..b7ea9821f33142cf4ab20d0a2962c4e79ac74f3e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ImpactedPerformanceIndicatorReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface ImpactedPerformanceIndicatorReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ImpactingDecisionReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ImpactingDecisionReference.java new file mode 100644 index 0000000000000000000000000000000000000000..4bdf00e51357c81947be1c157dc3aae58a26008c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ImpactingDecisionReference.java @@ -0,0 +1,20 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface ImpactingDecisionReference extends DmnElementReference { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Import.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Import.java new file mode 100644 index 0000000000000000000000000000000000000000..08cc11503ad24217c2406c63725fd7acf1218ad6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Import.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Import extends DmnModelElementInstance { + + String getNamespace(); + + void setNamespace(String namespace); + + String getLocationUri(); + + void setLocationUri(String locationUri); + + String getImportType(); + + void setImportType(String importType); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ImportedElement.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ImportedElement.java new file mode 100644 index 0000000000000000000000000000000000000000..26d1ec896a73cc7487312d527da7e80ba3244998 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ImportedElement.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface ImportedElement extends DmnModelElementInstance { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ImportedValues.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ImportedValues.java new file mode 100644 index 0000000000000000000000000000000000000000..7c0abe2d9b6b2b2c51473ac944fa8754ed240947 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ImportedValues.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface ImportedValues extends Import { + + String getExpressionLanguage(); + + void setExpressionLanguage(String expressionLanguage); + + ImportedElement getImportedElement(); + + void setImportedElement(ImportedElement importedElement); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InformationItem.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InformationItem.java new file mode 100644 index 0000000000000000000000000000000000000000..7e76c0b26dbe61ac8a45b1052377ac9697bbadca --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InformationItem.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface InformationItem extends NamedElement { + + String getTypeRef(); + + void setTypeRef(String typeRef); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InformationRequirement.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InformationRequirement.java new file mode 100644 index 0000000000000000000000000000000000000000..52117d1f791a671a425792d987fa247498125eaa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InformationRequirement.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface InformationRequirement extends DmnModelElementInstance { + + Decision getRequiredDecision(); + + void setRequiredDecision(Decision requiredDecision); + + InputData getRequiredInput(); + + void setRequiredInput(InputData requiredInput); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Input.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Input.java new file mode 100644 index 0000000000000000000000000000000000000000..f1785ec6588ef1a4cde71870ccbde030ecf93b84 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Input.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Input extends InputClause { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputClause.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputClause.java new file mode 100644 index 0000000000000000000000000000000000000000..b534addb66d28369b27d8155debbb658fed83a91 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputClause.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface InputClause extends DmnElement { + + InputExpression getInputExpression(); + + void setInputExpression(InputExpression inputExpression); + + InputValues getInputValues(); + + void setInputValues(InputValues inputValues); + + // camunda extensions + + String getCamundaInputVariable(); + + void setCamundaInputVariable(String inputVariable); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputData.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputData.java new file mode 100644 index 0000000000000000000000000000000000000000..8f82c973d3ac204b0d841c6009e89bae999c15a3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputData.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface InputData extends DrgElement { + + InformationItem getInformationItem(); + + void setInformationItem(InformationItem informationItem); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputDataReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputDataReference.java new file mode 100644 index 0000000000000000000000000000000000000000..33dfbd7431e7c775597d766cf9e39a5d819f43f0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputDataReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface InputDataReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputDecisionReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputDecisionReference.java new file mode 100644 index 0000000000000000000000000000000000000000..0c504b5684c2792f90fd4a4888d77f1aa90a8e27 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputDecisionReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface InputDecisionReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputEntry.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputEntry.java new file mode 100644 index 0000000000000000000000000000000000000000..422b38d5751a2b866f5097e02c7d032c5c0901d0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputEntry.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface InputEntry extends UnaryTests { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputExpression.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputExpression.java new file mode 100644 index 0000000000000000000000000000000000000000..dff759fc607998f9caa96910db82039363f61746 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputExpression.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface InputExpression extends LiteralExpression { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputValues.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputValues.java new file mode 100644 index 0000000000000000000000000000000000000000..04c805929593c2c004533cef8d9822cc6b58e3f6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/InputValues.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface InputValues extends UnaryTests { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Invocation.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Invocation.java new file mode 100644 index 0000000000000000000000000000000000000000..b1b120190bcd5c153352f222e8839b146bbd2d06 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Invocation.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface Invocation extends Expression { + + Expression getExpression(); + + void setExpression(Expression expression); + + Collection getBindings(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ItemComponent.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ItemComponent.java new file mode 100644 index 0000000000000000000000000000000000000000..230e61a713364f200508b7531c5b88bb75f1753a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ItemComponent.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface ItemComponent extends ItemDefinition { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ItemDefinition.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ItemDefinition.java new file mode 100644 index 0000000000000000000000000000000000000000..d1326ba8885eb67eddd9b1c3f57efb8a4f9159b5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ItemDefinition.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface ItemDefinition extends NamedElement { + + String getTypeLanguage(); + + void setTypeLanguage(String typeLanguage); + + boolean isCollection(); + + void setCollection(boolean isCollection); + + TypeRef getTypeRef(); + + void setTypeRef(TypeRef typeRef); + + AllowedValues getAllowedValues(); + + void setAllowedValues(AllowedValues allowedValues); + + Collection getItemComponents(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ItemDefinitionReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ItemDefinitionReference.java new file mode 100644 index 0000000000000000000000000000000000000000..0dadacdd4aa35781e4c4042cc25df34937682abf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/ItemDefinitionReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface ItemDefinitionReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/KnowledgeRequirement.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/KnowledgeRequirement.java new file mode 100644 index 0000000000000000000000000000000000000000..91d31dae514dedbfe9aeee286a976e64162f9532 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/KnowledgeRequirement.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface KnowledgeRequirement extends DmnModelElementInstance { + + BusinessKnowledgeModel getRequiredKnowledge(); + + void setRequiredKnowledge(BusinessKnowledgeModel requiredKnowledge); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/KnowledgeSource.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/KnowledgeSource.java new file mode 100644 index 0000000000000000000000000000000000000000..2d6ba66ee900d6f06590159bfc9f1ded1db07a22 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/KnowledgeSource.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface KnowledgeSource extends DrgElement { + + String getLocationUri(); + + void setLocationUri(String locationUri); + + Collection getAuthorityRequirement(); + + Type getType(); + + void setType(Type type); + + OrganizationUnit getOwner(); + + void setOwner(OrganizationUnit owner); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/List.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/List.java new file mode 100644 index 0000000000000000000000000000000000000000..23f8dbe4d0a3c8e46ab7ad89e93bd87ea8c01ea5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/List.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface List extends Expression { + + Collection getExpressions(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/LiteralExpression.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/LiteralExpression.java new file mode 100644 index 0000000000000000000000000000000000000000..6ce69fccc5c0189b4bf76529fb4b3dd95aa9eaec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/LiteralExpression.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface LiteralExpression extends Expression { + + String getExpressionLanguage(); + + void setExpressionLanguage(String expressionLanguage); + + Text getText(); + + void setText(Text text); + + ImportedValues getImportValues(); + + void setImportValues(ImportedValues importedValues); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/NamedElement.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/NamedElement.java new file mode 100644 index 0000000000000000000000000000000000000000..816834f9cd394ea0acebb2cd95b136c4d9ad8861 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/NamedElement.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface NamedElement extends DmnElement { + + String getName(); + + void setName(String name); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OrganizationUnit.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OrganizationUnit.java new file mode 100644 index 0000000000000000000000000000000000000000..b0ebd0d6e9314032d4717821c8b1565cd507d466 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OrganizationUnit.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface OrganizationUnit extends BusinessContextElement { + + Collection getDecisionsMade(); + + Collection getDecisionsOwned(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Output.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Output.java new file mode 100644 index 0000000000000000000000000000000000000000..ae498fc893aac3111ea7775f73a040a244068b12 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Output.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Output extends OutputClause { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OutputClause.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OutputClause.java new file mode 100644 index 0000000000000000000000000000000000000000..814278a1a64dd5cc7cf12011f802ce4f6a1d6781 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OutputClause.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface OutputClause extends DmnElement { + + String getName(); + + void setName(String name); + + String getTypeRef(); + + void setTypeRef(String typeRef); + + OutputValues getOutputValues(); + + void setOutputValues(OutputValues outputValues); + + DefaultOutputEntry getDefaultOutputEntry(); + + void setDefaultOutputEntry(DefaultOutputEntry defaultOutputEntry); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OutputDecisionReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OutputDecisionReference.java new file mode 100644 index 0000000000000000000000000000000000000000..f44ed0fe0f67b2f858e0435526a1fa5448502525 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OutputDecisionReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface OutputDecisionReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OutputEntry.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OutputEntry.java new file mode 100644 index 0000000000000000000000000000000000000000..ac839eda6a547e77f04c5b77069dc6d233f3512c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OutputEntry.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface OutputEntry extends LiteralExpression { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OutputValues.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OutputValues.java new file mode 100644 index 0000000000000000000000000000000000000000..e5acb7cb046b7ded64a52380dbd9d22157471204 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OutputValues.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface OutputValues extends UnaryTests { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OwnerReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OwnerReference.java new file mode 100644 index 0000000000000000000000000000000000000000..23ce1bb7e33bbbbb57ec1d3dd364771f23b1b0b8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/OwnerReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface OwnerReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Parameter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Parameter.java new file mode 100644 index 0000000000000000000000000000000000000000..4195231e9b1d77071b42747df54a8c44985c6416 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Parameter.java @@ -0,0 +1,20 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Parameter extends InformationItem { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/PerformanceIndicator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/PerformanceIndicator.java new file mode 100644 index 0000000000000000000000000000000000000000..353af4c3bd8ed94645a4ad72aa61b53555cec105 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/PerformanceIndicator.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface PerformanceIndicator extends BusinessContextElement { + + Collection getImpactingDecisions(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Question.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Question.java new file mode 100644 index 0000000000000000000000000000000000000000..8ba8d291d9b9d0f6052b6ebdef3969e1ff2e1350 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Question.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Question extends DmnModelElementInstance { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Relation.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Relation.java new file mode 100644 index 0000000000000000000000000000000000000000..1127b37f76f15ce9e4beac70b6a69a25cb418340 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Relation.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public interface Relation extends Expression { + + Collection getColumns(); + + Collection getRows(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/RequiredAuthorityReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/RequiredAuthorityReference.java new file mode 100644 index 0000000000000000000000000000000000000000..9e99e891a56d1d08102c58870a276b17f264cda7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/RequiredAuthorityReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface RequiredAuthorityReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/RequiredDecisionReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/RequiredDecisionReference.java new file mode 100644 index 0000000000000000000000000000000000000000..8778cf8d51a38a300446dceaffff325ff907726e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/RequiredDecisionReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface RequiredDecisionReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/RequiredInputReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/RequiredInputReference.java new file mode 100644 index 0000000000000000000000000000000000000000..d17101ecf745508fd21f55780894e985c28694c1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/RequiredInputReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface RequiredInputReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/RequiredKnowledgeReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/RequiredKnowledgeReference.java new file mode 100644 index 0000000000000000000000000000000000000000..51ab4e9ea6c48b541cb286dd45c6f5d687417e2f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/RequiredKnowledgeReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface RequiredKnowledgeReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Row.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Row.java new file mode 100644 index 0000000000000000000000000000000000000000..f80fba0e59cfacca8b67f82cd4db57a54c70c33d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Row.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Row extends List { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Rule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Rule.java new file mode 100644 index 0000000000000000000000000000000000000000..211debc8cffa9ee61e4dc44d714b74de56d14325 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Rule.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Rule extends DecisionRule { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/SourceRef.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/SourceRef.java new file mode 100644 index 0000000000000000000000000000000000000000..9a8a2b41a3e087d19dfe66ebbbcea04cf089fdae --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/SourceRef.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface SourceRef extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/SupportedObjectiveReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/SupportedObjectiveReference.java new file mode 100644 index 0000000000000000000000000000000000000000..857f80e225e86095c18b15ca58b9c2bbcc1d48a9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/SupportedObjectiveReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface SupportedObjectiveReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/TargetRef.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/TargetRef.java new file mode 100644 index 0000000000000000000000000000000000000000..f83adbea4bea1ba5c79964b421ee66e0c32ee9e6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/TargetRef.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface TargetRef extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Text.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Text.java new file mode 100644 index 0000000000000000000000000000000000000000..312c8f3f2c43fa7d7b8682ded96188986393389b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Text.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Text extends DmnModelElementInstance { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/TextAnnotation.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/TextAnnotation.java new file mode 100644 index 0000000000000000000000000000000000000000..841884678637a540919ff5ce3f951e6595e52f82 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/TextAnnotation.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface TextAnnotation extends Artifact { + + String getTextFormat(); + + void setTextFormat(String textFormat); + + Text getText(); + + void setText(Text text); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Type.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Type.java new file mode 100644 index 0000000000000000000000000000000000000000..c247f32d3b1c0d6603a949144f21aeb582dcc93c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Type.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Type extends DmnModelElementInstance { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/TypeRef.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/TypeRef.java new file mode 100644 index 0000000000000000000000000000000000000000..d45ed26be0a92a2c36f151200e9be7f383ead955 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/TypeRef.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface TypeRef extends DmnModelElementInstance { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/UnaryTests.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/UnaryTests.java new file mode 100644 index 0000000000000000000000000000000000000000..5f6c98e3f10c213d3642809e5a40ed965e2ef219 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/UnaryTests.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface UnaryTests extends DmnElement { + + String getExpressionLanguage(); + + void setExpressionLanguage(String expressionLanguage); + + Text getText(); + + void setText(Text text); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/UsingProcessReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/UsingProcessReference.java new file mode 100644 index 0000000000000000000000000000000000000000..ab5438d1984b5d8e9b287ee5d79af0ba23c6b8aa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/UsingProcessReference.java @@ -0,0 +1,20 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface UsingProcessReference extends DmnElementReference { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/UsingTaskReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/UsingTaskReference.java new file mode 100644 index 0000000000000000000000000000000000000000..e5668c57398092f96ebb4e56875ad4929f82e8d0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/UsingTaskReference.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface UsingTaskReference extends DmnElementReference { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Variable.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Variable.java new file mode 100644 index 0000000000000000000000000000000000000000..1943ca09c85f09cc65b6912cc69cc8e9ee8f63e3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/instance/Variable.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public interface Variable extends InformationItem { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DC.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DC.xsd new file mode 100644 index 0000000000000000000000000000000000000000..634ba13a3efefb36c2b2c95dc4eb4e2de326d258 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DC.xsd @@ -0,0 +1,159 @@ + + + + + + + + + + + Color is a data type that represents a color value in the RGB format. + + + + + + + + + + + + + + + + A Point specifies an location in some x-y coordinate system. + + + + + + + + Dimension specifies two lengths (width and height) along the x and y axes in some x-y coordinate system. + + + + + + + + Bounds specifies a rectangular area in some x-y coordinate system that is defined by a location (x and y) and a size (width and height). + + + + + + + + + + AlignmentKind enumerates the possible options for alignment for layout purposes. + + + + + + + + + + + KnownColor is an enumeration of 17 known colors. + + + + + a color with a value of #800000 + + + + + a color with a value of #FF0000 + + + + + a color with a value of #FFA500 + + + + + a color with a value of #FFFF00 + + + + + a color with a value of #808000 + + + + + a color with a value of #800080 + + + + + a color with a value of #FF00FF + + + + + a color with a value of #FFFFFF + + + + + a color with a value of #00FF00 + + + + + a color with a value of #008000 + + + + + a color with a value of #000080 + + + + + a color with a value of #0000FF + + + + + a color with a value of #00FFFF + + + + + a color with a value of #008080 + + + + + a color with a value of #000000 + + + + + a color with a value of #C0C0C0 + + + + + a color with a value of #808080 + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DI.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DI.xsd new file mode 100644 index 0000000000000000000000000000000000000000..9022a67145e9fe1a114004ed553e2d906147a609 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DI.xsd @@ -0,0 +1,115 @@ + + + + + + The Diagram Interchange (DI) package enables interchange of graphical information that language users have control over, such as position of nodes and line routing points. Language specifications specialize elements of DI to define diagram interchange elements for a language. + + + + + This element should never be instantiated directly, but rather concrete implementation should. It is placed there only to be referred in the sequence + + + + + + DiagramElement is the abstract super type of all elements in diagrams, including diagrams themselves. When contained in a diagram, diagram elements are laid out relative to the diagram's origin. + + + + + + + + + + + + an optional locally-owned style for this diagram element. + + + + + + a reference to an optional shared style element for this diagram element. + + + + + + + + + + + + the name of the diagram. + + + + + the documentation of the diagram. + + + + + the resolution of the diagram expressed in user units per inch. + + + + + + + + + + + + + the optional bounds of the shape relative to the origin of its nesting plane. + + + + + + + + + + + + + + an optional list of points relative to the origin of the nesting diagram that specifies the connected line segments of the edge + + + + + + + + + + Style contains formatting properties that affect the appearance or style of diagram elements, including diagram themselves. + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN11.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN11.xsd new file mode 100644 index 0000000000000000000000000000000000000000..03a04b8f432064a8eaf74ac206fd8a2cf4826720 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN11.xsd @@ -0,0 +1,438 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN11_Alternative.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN11_Alternative.xsd new file mode 100644 index 0000000000000000000000000000000000000000..b9210bd79e18c0a43004d0eec581fdf6ff46dadd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN11_Alternative.xsd @@ -0,0 +1,438 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN12.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN12.xsd new file mode 100644 index 0000000000000000000000000000000000000000..47ade4cedde06ec7f3b9f9395447d374794e7bff --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN12.xsd @@ -0,0 +1,504 @@ + + + + + + + Include the DMN Diagram Interchange (DI) schema + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN13.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN13.xsd new file mode 100644 index 0000000000000000000000000000000000000000..ab17346f778e3d02fd0a6f196214f3366ef3cfb0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN13.xsd @@ -0,0 +1,524 @@ + + + + + + + Include the DMN Diagram Interchange (DI) schema + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN14.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN14.xsd new file mode 100644 index 0000000000000000000000000000000000000000..c063964df4489a3d9cf5b86ea56b2546a79db19f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN14.xsd @@ -0,0 +1,591 @@ + + + + + + + Include the DMN Diagram Interchange (DI) schema + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN15.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN15.xsd new file mode 100644 index 0000000000000000000000000000000000000000..3ae7227f15c469cce0f88a68918b8cfe78ec97d1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMN15.xsd @@ -0,0 +1,592 @@ + + + + + + + Include the DMN Diagram Interchange (DI) schema + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMNDI12.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMNDI12.xsd new file mode 100644 index 0000000000000000000000000000000000000000..c3776064d8216c32f7f19fb17b8b231789fbb372 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMNDI12.xsd @@ -0,0 +1,106 @@ + + + + + + + + + + + This element should never be instantiated directly, but rather concrete implementation should. It is placed there only to be referred in the sequence + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMNDI13.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMNDI13.xsd new file mode 100644 index 0000000000000000000000000000000000000000..5c60c966a6e789541521c6a9572dc698336d39d1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMNDI13.xsd @@ -0,0 +1,108 @@ + + + + + + + + + + + This element should never be instantiated directly, but rather concrete implementation should. It is placed there only to be referred in the sequence + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMNDI15.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMNDI15.xsd new file mode 100644 index 0000000000000000000000000000000000000000..1bdf4669a01c395e17d16fe716259477b60e48dd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/main/resources/org/camunda/bpm/model/dmn/schema/DMNDI15.xsd @@ -0,0 +1,109 @@ + + + + + + + + + + + This element should never be instantiated directly, but rather concrete implementation should. It is placed there only to be referred in the sequence + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/CamundaExtensionsTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/CamundaExtensionsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ecb0ab39ea8e5dc67dd44290e02ee9b324474e51 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/CamundaExtensionsTest.java @@ -0,0 +1,87 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.dmn.instance.Decision; +import org.camunda.bpm.model.dmn.instance.Input; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class CamundaExtensionsTest { + + private final DmnModelInstance originalModelInstance; + private DmnModelInstance modelInstance; + + @Parameters(name="Namespace: {0}") + public static Collection parameters(){ + return Arrays.asList(new Object[][]{ + {Dmn.readModelFromStream(CamundaExtensionsTest.class.getResourceAsStream("CamundaExtensionsTest.dmn"))}, + // for compatibility reasons we gotta check the old namespace, too + {Dmn.readModelFromStream(CamundaExtensionsTest.class.getResourceAsStream("CamundaExtensionsCompatibilityTest.dmn"))} + }); + } + + public CamundaExtensionsTest(DmnModelInstance originalModelInstance) { + this.originalModelInstance = originalModelInstance; + } + + @Before + public void parseModel() { + modelInstance = originalModelInstance.clone(); + + } + + @Test + public void testCamundaClauseOutput() { + Input input = modelInstance.getModelElementById("input"); + assertThat(input.getCamundaInputVariable()).isEqualTo("myVariable"); + input.setCamundaInputVariable("foo"); + assertThat(input.getCamundaInputVariable()).isEqualTo("foo"); + } + + @Test + public void testCamundaHistoryTimeToLive() { + Decision decision = modelInstance.getModelElementById("decision"); + assertThat(decision.getCamundaHistoryTimeToLive()).isEqualTo(5); + decision.setCamundaHistoryTimeToLive(6); + assertThat(decision.getCamundaHistoryTimeToLive()).isEqualTo(6); + } + + @Test + public void testCamundaVersionTag() { + Decision decision = modelInstance.getModelElementById("decision"); + assertThat(decision.getVersionTag()).isEqualTo("1.0.0"); + decision.setVersionTag("1.1.0"); + assertThat(decision.getVersionTag()).isEqualTo("1.1.0"); + } + + @After + public void validateModel() { + Dmn.validateModel(modelInstance); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnDiTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnDiTest.java new file mode 100644 index 0000000000000000000000000000000000000000..727712e2eac2d023238ab8a7c80e358a391e8ad2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnDiTest.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import org.junit.Test; + +public class DmnDiTest { + + @Test + public void validateDmnWithCamundaDi() { + + DmnModelInstance modelInstance = Dmn.readModelFromStream(DmnDiTest.class.getResourceAsStream("ExampleWithCamundaDI.dmn")); + + Dmn.validateModel(modelInstance); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnModelInstanceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnModelInstanceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..445cca44d067fb11217e382c6514ecce55f7b857 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnModelInstanceTest.java @@ -0,0 +1,63 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.camunda.bpm.model.dmn.impl.DmnModelConstants; +import org.camunda.bpm.model.dmn.instance.Definitions; +import org.junit.Test; + +/** + * @author Filip Hrisafov + */ +public class DmnModelInstanceTest { + + @Test + public void testClone() throws Exception { + + DmnModelInstance modelInstance = Dmn.createEmptyModel(); + + Definitions definitions = modelInstance.newInstance(Definitions.class); + definitions.setId("TestId"); + modelInstance.setDefinitions(definitions); + + DmnModelInstance cloneInstance = modelInstance.clone(); + cloneInstance.getDefinitions().setId("TestId2"); + + assertThat(modelInstance.getDefinitions().getId()).isEqualTo("TestId"); + assertThat(cloneInstance.getDefinitions().getId()).isEqualTo("TestId2"); + } + + @Test + public void shouldExportDmnDiagramWithLatestDmnNamespace() { + // given + DmnModelInstance modelInstance = Dmn.createEmptyModel(); + Definitions definitions = modelInstance.newInstance(Definitions.class); + definitions.setNamespace("http://camunda.org/schema/1.0/dmn"); + definitions.setName("definitions"); + definitions.setId("definitions"); + modelInstance.setDefinitions(definitions); + + // when + String exportedDiagram = Dmn.convertToString(modelInstance); + + // then + assertThat(exportedDiagram).contains(DmnModelConstants.LATEST_DMN_NS); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnModelTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnModelTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7169aecfb0c3f15ac5deb71cd568c4006ff95f66 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnModelTest.java @@ -0,0 +1,126 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + +import java.io.File; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.camunda.bpm.model.dmn.instance.DmnElement; +import org.camunda.bpm.model.dmn.instance.DmnModelElementInstance; +import org.camunda.bpm.model.dmn.instance.NamedElement; +import org.camunda.bpm.model.dmn.util.Java9CDataWhitespaceFilter; +import org.camunda.bpm.model.dmn.util.ParseDmnModelRule; +import org.camunda.bpm.model.xml.impl.util.ReflectUtil; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.TemporaryFolder; +import org.w3c.dom.Document; +import org.xmlunit.builder.DiffBuilder; +import org.xmlunit.diff.Diff; + +public abstract class DmnModelTest { + + public final static String TEST_NAMESPACE = "http://camunda.org/schema/1.0/dmn"; + + @Rule + public final ParseDmnModelRule parseDmnModelRule = new ParseDmnModelRule(); + + @Rule + public TemporaryFolder tmpFolder = new TemporaryFolder(); + + protected DmnModelInstance modelInstance; + + @Before + public void setup() { + modelInstance = parseDmnModelRule.getDmnModel(); + } + + public E generateNamedElement(Class elementClass) { + return generateNamedElement(elementClass, ""); + } + + public E generateNamedElement(Class elementClass, Integer suffix) { + return generateNamedElement(elementClass, "", suffix); + } + + public E generateNamedElement(Class elementClass, String name) { + return generateNamedElement(elementClass, name, null); + } + + public E generateNamedElement(Class elementClass, String name, Integer suffix) { + E element = generateElement(elementClass, suffix); + element.setName(name); + return element; + } + + public E generateElement(Class elementClass) { + return generateElement(elementClass, null); + } + + public E generateElement(Class elementClass, Integer suffix) { + E element = modelInstance.newInstance(elementClass); + if (element instanceof DmnElement) { + String identifier = elementClass.getSimpleName(); + if (suffix != null) { + identifier += suffix.toString(); + } + identifier = Character.toLowerCase(identifier.charAt(0)) + identifier.substring(1); + ((DmnElement) element).setId(identifier); + } + return element; + } + + protected void assertModelEqualsFile(String expectedPath) throws Exception { + File actualFile = tmpFolder.newFile(); + Dmn.writeModelToFile(actualFile, modelInstance); + + File expectedFile = ReflectUtil.getResourceAsFile(expectedPath); + + DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); + Document actualDocument = docBuilder.parse(actualFile); + Document expectedDocument = docBuilder.parse(expectedFile); + + Diff diff = DiffBuilder.compare(expectedDocument).withTest(actualDocument) + .withNodeFilter(new Java9CDataWhitespaceFilter()) + .checkForSimilar() + .build(); + + if (diff.hasDifferences()) { + + String failMsg = "XML differs:\n" + diff.getDifferences() + + "\n\nActual XML:\n" + Dmn.convertToString(modelInstance); + fail(failMsg); + } + } + + protected void assertElementIsEqualToId(DmnModelElementInstance actualElement, String id) { + assertThat(actualElement).isNotNull(); + + ModelElementInstance expectedElement = modelInstance.getModelElementById(id); + assertThat(expectedElement).isNotNull(); + + assertThat(actualElement).isEqualTo(expectedElement); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5c07a11bea35ec1c902357298cbd6d361df87b11 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnTest.java @@ -0,0 +1,30 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; + +public class DmnTest { + + @Test + public void testDmn() { + assertThat(Dmn.INSTANCE).isNotNull(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnWriterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnWriterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9acd442a46f3cfff0817094d5e7e3313b011a06d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/DmnWriterTest.java @@ -0,0 +1,74 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.camunda.bpm.model.dmn.instance.Decision; +import org.camunda.bpm.model.dmn.instance.DecisionTable; +import org.camunda.bpm.model.dmn.instance.InputEntry; +import org.camunda.bpm.model.dmn.instance.Rule; +import org.junit.Test; + +public class DmnWriterTest extends DmnModelTest { + + /** + *

There is an issue in JDK 9+ that changes how CDATA section are serialized: + * + *

https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8223291 + * + *

< JDK9: + * + *

+   * <inputEntry id="inputEntry1">
+   *   <text><![CDATA[>= 1000]]></text>
+   * </inputEntry>
+   * 
+ * + *

(the text element has one child node, a CDATA section) + * + *

>= JDK9: + * + *

+   * <inputEntry id="inputEntry1">
+   *   <text>
+   *     <![CDATA[>= 1000]]>
+   *   </text>
+   * </inputEntry>
+   * 
+ * + *

(the text element has three child nodes, a text node, a CDATA section and another text node) + * + *

This test ensures, that a JDK9-formatted model can be read + * and the text content method returns the CDATA value only + */ + @Test + public void shouldReadJDK9StyleModel() + { + DmnModelInstance modelInstance = + Dmn.readModelFromStream(ExampleCompatibilityTest.class.getResourceAsStream("JDK9-style-CDATA.dmn")); + + Decision decision = (Decision) modelInstance.getDefinitions().getDrgElements().iterator().next(); + + DecisionTable decisionTable = (DecisionTable) decision.getExpression(); + + Rule rule = decisionTable.getRules().iterator().next(); + InputEntry inputEntry = rule.getInputEntries().iterator().next(); + String textContent = inputEntry.getText().getTextContent(); + assertThat(textContent).isEqualTo(">= 1000"); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/ExampleCompatibilityTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/ExampleCompatibilityTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9f77e19f2545c22e09f34d0d1489759b7f7884dd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/ExampleCompatibilityTest.java @@ -0,0 +1,384 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.camunda.bpm.model.dmn.instance.BusinessContextElement; +import org.camunda.bpm.model.dmn.instance.Decision; +import org.camunda.bpm.model.dmn.instance.DecisionTable; +import org.camunda.bpm.model.dmn.instance.Definitions; +import org.camunda.bpm.model.dmn.instance.DrgElement; +import org.camunda.bpm.model.dmn.instance.ElementCollection; +import org.camunda.bpm.model.dmn.instance.Import; +import org.camunda.bpm.model.dmn.instance.Input; +import org.camunda.bpm.model.dmn.instance.InputEntry; +import org.camunda.bpm.model.dmn.instance.InputExpression; +import org.camunda.bpm.model.dmn.instance.InputValues; +import org.camunda.bpm.model.dmn.instance.ItemDefinition; +import org.camunda.bpm.model.dmn.instance.Output; +import org.camunda.bpm.model.dmn.instance.OutputEntry; +import org.camunda.bpm.model.dmn.instance.OutputValues; +import org.camunda.bpm.model.dmn.instance.Rule; +import org.camunda.bpm.model.dmn.instance.Text; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class ExampleCompatibilityTest extends DmnModelTest { + + public static final String EXAMPLE_DMN = "org/camunda/bpm/model/dmn/Example.dmn"; + + private final DmnModelInstance originalModelInstance; + + @Parameterized.Parameters(name="Namespace: {0}") + public static Collection parameters(){ + return Arrays.asList(new Object[][]{ + {Dmn.readModelFromStream(ExampleCompatibilityTest.class.getResourceAsStream("Example.dmn"))}, + // for compatibility reasons we gotta check the old namespace, too + {Dmn.readModelFromStream(ExampleCompatibilityTest.class.getResourceAsStream("ExampleCompatibility.dmn"))}, + // DMN 1.2 + {Dmn.readModelFromStream(ExampleCompatibilityTest.class.getResourceAsStream("Example-DMN-1.2.dmn"))}, + // DMN 1.3 + {Dmn.readModelFromStream(ExampleCompatibilityTest.class.getResourceAsStream("Example-DMN-1.3.dmn"))}, + // DMN 1.4 + {Dmn.readModelFromStream(ExampleCompatibilityTest.class.getResourceAsStream("Example-DMN-1.4.dmn"))}, + // DMN 1.5 + {Dmn.readModelFromStream(ExampleCompatibilityTest.class.getResourceAsStream("Example-DMN-1.5.dmn"))} + }); + } + + public ExampleCompatibilityTest(DmnModelInstance originalModelInstance) { + this.originalModelInstance = originalModelInstance; + } + + @Before + public void parseModel() { + modelInstance = originalModelInstance.clone(); + } + + @Test + public void shouldGetElements() { + + // Definitions + Definitions definitions = modelInstance.getDefinitions(); + assertThat(definitions).isNotNull(); + assertThat(definitions.getId()).isEqualTo("definitions"); + assertThat(definitions.getName()).isEqualTo("definitions"); + assertThat(definitions.getNamespace()).isEqualTo(TEST_NAMESPACE); + assertElementIsEqualToId(definitions, "definitions"); + + // Imports + Collection imports = definitions.getImports(); + assertThat(imports).isEmpty(); + + // Item definitions + Collection itemDefinitions = definitions.getItemDefinitions(); + assertThat(itemDefinitions).isEmpty(); + + // DRG elements + Collection drgElements = definitions.getDrgElements(); + assertThat(drgElements).isNotEmpty().hasSize(1); + + // Decision + Decision decision = (Decision) drgElements.iterator().next(); + assertThat(decision).isNotNull(); + assertThat(decision.getId()).isEqualTo("decision"); + assertThat(decision.getName()).isEqualTo("Check Order"); + assertElementIsEqualToId(decision, "decision"); + + // Decision table + DecisionTable decisionTable = (DecisionTable) decision.getExpression(); + assertThat(decisionTable).isNotNull(); + assertThat(decisionTable.getId()).isEqualTo("decisionTable"); + assertElementIsEqualToId(decisionTable, "decisionTable"); + + // Input clauses + List inputs = new ArrayList<>(decisionTable.getInputs()); + assertThat(inputs).hasSize(2); + Iterator inputIterator = inputs.iterator(); + + // 1. Input clause + Input input = inputIterator.next(); + assertThat(input.getId()).isEqualTo("input1"); + assertThat(input.getLabel()).isEqualTo("Customer Status"); + InputExpression inputExpression = input.getInputExpression(); + assertThat(inputExpression.getId()).isEqualTo("inputExpression1"); + assertThat(inputExpression.getTypeRef()).isEqualTo("string"); + assertThat(inputExpression.getText().getTextContent()).isEqualTo("status"); + InputValues inputValues = input.getInputValues(); + assertThat(inputValues.getText().getTextContent()).isEqualTo("\"bronze\",\"silver\",\"gold\""); + + // 2. Input clause + input = inputIterator.next(); + assertThat(input.getId()).isEqualTo("input2"); + assertThat(input.getLabel()).isEqualTo("Order Sum"); + inputExpression = input.getInputExpression(); + assertThat(inputExpression.getId()).isEqualTo("inputExpression2"); + assertThat(inputExpression.getTypeRef()).isEqualTo("double"); + + // Output clause + List outputs = new ArrayList<>(decisionTable.getOutputs()); + assertThat(outputs).hasSize(2); + + // 1. Output clause + Output output = outputs.get(0); + assertThat(output.getId()).isEqualTo("output1"); + assertThat(output.getLabel()).isEqualTo("Check Result"); + assertThat(output.getName()).isEqualTo("result"); + assertThat(output.getTypeRef()).isEqualTo("string"); + OutputValues outputValues = output.getOutputValues(); + assertThat(outputValues.getText().getTextContent()).isEqualTo("\"ok\",\"notok\""); + + // 2. Output clause + output = outputs.get(1); + assertThat(output.getId()).isEqualTo("output2"); + assertThat(output.getLabel()).isEqualTo("Reason"); + assertThat(output.getName()).isEqualTo("reason"); + assertThat(output.getTypeRef()).isEqualTo("string"); + + // Rules + List rules = new ArrayList<>(decisionTable.getRules()); + + // 1. Rule + Rule rule = rules.get(0); + assertThat(rule.getId()).isEqualTo("rule1"); + List inputEntries = new ArrayList<>(rule.getInputEntries()); + assertThat(inputEntries).hasSize(2); + assertThat(inputEntries.get(0).getText().getTextContent()).isEqualTo("\"bronze\""); + assertThat(inputEntries.get(1).getText().getTextContent()).isEmpty(); + List outputEntries = new ArrayList<>(rule.getOutputEntries()); + assertThat(outputEntries).hasSize(2); + assertThat(outputEntries.get(0).getText().getTextContent()).isEqualTo("\"notok\""); + assertThat(outputEntries.get(1).getText().getTextContent()).isEqualTo("\"work on your status first, as bronze you're not going to get anything\""); + + // 2. Rule + rule = rules.get(1); + assertThat(rule.getId()).isEqualTo("rule2"); + inputEntries = new ArrayList<>(rule.getInputEntries()); + assertThat(inputEntries).hasSize(2); + assertThat(inputEntries.get(0).getText().getTextContent()).isEqualTo("\"silver\""); + assertThat(inputEntries.get(1).getText().getTextContent()).isEqualTo("< 1000"); + outputEntries = new ArrayList<>(rule.getOutputEntries()); + assertThat(outputEntries).hasSize(2); + assertThat(outputEntries.get(0).getText().getTextContent()).isEqualTo("\"ok\""); + assertThat(outputEntries.get(1).getText().getTextContent()).isEqualTo("\"you little fish will get what you want\""); + + // 3. Rule + rule = rules.get(2); + assertThat(rule.getId()).isEqualTo("rule3"); + inputEntries = new ArrayList<>(rule.getInputEntries()); + assertThat(inputEntries).hasSize(2); + assertThat(inputEntries.get(0).getText().getTextContent()).isEqualTo("\"silver\""); + assertThat(inputEntries.get(1).getText().getTextContent()).isEqualTo(">= 1000"); + outputEntries = new ArrayList<>(rule.getOutputEntries()); + assertThat(outputEntries).hasSize(2); + assertThat(outputEntries.get(0).getText().getTextContent()).isEqualTo("\"notok\""); + assertThat(outputEntries.get(1).getText().getTextContent()).isEqualTo("\"you took too much man, you took too much!\""); + + // 4. Rule + rule = rules.get(3); + assertThat(rule.getId()).isEqualTo("rule4"); + inputEntries = new ArrayList<>(rule.getInputEntries()); + assertThat(inputEntries).hasSize(2); + assertThat(inputEntries.get(0).getText().getTextContent()).isEqualTo("\"gold\""); + assertThat(inputEntries.get(1).getText().getTextContent()).isEmpty(); + outputEntries = new ArrayList<>(rule.getOutputEntries()); + assertThat(outputEntries).hasSize(2); + assertThat(outputEntries.get(0).getText().getTextContent()).isEqualTo("\"ok\""); + assertThat(outputEntries.get(1).getText().getTextContent()).isEqualTo("\"you get anything you want\""); + + // Element collections + Collection elementCollections = definitions.getElementCollections(); + assertThat(elementCollections).isEmpty(); + + // Business contexts + Collection businessContextElements = definitions.getBusinessContextElements(); + assertThat(businessContextElements).isEmpty(); + } + + @Test + public void shouldWriteElements() throws Exception { + modelInstance = Dmn.createEmptyModel(); + + // Definitions + Definitions definitions = generateNamedElement(Definitions.class, "definitions"); + definitions.setNamespace(TEST_NAMESPACE); + modelInstance.setDocumentElement(definitions); + + // Decision + Decision decision = generateNamedElement(Decision.class, "Check Order"); + definitions.addChildElement(decision); + + // Decision table + DecisionTable decisionTable = generateElement(DecisionTable.class); + decision.addChildElement(decisionTable); + + // 1. Input clause + Input input = generateElement(Input.class, 1); + input.setLabel("Customer Status"); + InputExpression inputExpression = generateElement(InputExpression.class, 1); + inputExpression.setTypeRef("string"); + Text text = generateElement(Text.class); + text.setTextContent("status"); + inputExpression.setText(text); + input.setInputExpression(inputExpression); + InputValues inputValues = generateElement(InputValues.class); + text = generateElement(Text.class); + text.setTextContent("\"bronze\",\"silver\",\"gold\""); + inputValues.setText(text); + input.setInputValues(inputValues); + decisionTable.getInputs().add(input); + + // 2. Input clause + input = generateElement(Input.class, 2); + input.setLabel("Order Sum"); + inputExpression = generateElement(InputExpression.class, 2); + inputExpression.setTypeRef("double"); + text = generateElement(Text.class); + text.setTextContent("sum"); + inputExpression.setText(text); + input.setInputExpression(inputExpression); + decisionTable.getInputs().add(input); + + // 1. Output clause + Output output = generateElement(Output.class, 1); + output.setLabel("Check Result"); + output.setName("result"); + output.setTypeRef("string"); + OutputValues outputValues = generateElement(OutputValues.class); + text = generateElement(Text.class); + text.setTextContent("\"ok\",\"notok\""); + outputValues.setText(text); + output.setOutputValues(outputValues); + decisionTable.getOutputs().add(output); + + // 2. Output clause + output = generateElement(Output.class, 2); + output.setLabel("Reason"); + output.setName("reason"); + output.setTypeRef("string"); + decisionTable.getOutputs().add(output); + + // 1. Rule + Rule rule = generateElement(Rule.class, 1); + InputEntry inputEntry = generateElement(InputEntry.class, 1); + text = generateElement(Text.class); + text.setTextContent("\"bronze\""); + inputEntry.setText(text); + rule.getInputEntries().add(inputEntry); + inputEntry = generateElement(InputEntry.class, 2); + text = generateElement(Text.class); + text.setTextContent(""); + inputEntry.setText(text); + rule.getInputEntries().add(inputEntry); + OutputEntry outputEntry = generateElement(OutputEntry.class, 1); + text = generateElement(Text.class); + text.setTextContent("\"notok\""); + outputEntry.setText(text); + rule.getOutputEntries().add(outputEntry); + outputEntry = generateElement(OutputEntry.class, 2); + text = generateElement(Text.class); + text.getDomElement().addCDataSection("\"work on your status first, as bronze you're not going to get anything\""); + outputEntry.setText(text); + rule.getOutputEntries().add(outputEntry); + decisionTable.getRules().add(rule); + + // 2. Rule + rule = generateElement(Rule.class, 2); + inputEntry = generateElement(InputEntry.class, 3); + text = generateElement(Text.class); + text.setTextContent("\"silver\""); + rule.getInputEntries().add(inputEntry); + inputEntry.setText(text); + inputEntry = generateElement(InputEntry.class, 4); + text = generateElement(Text.class); + text.getDomElement().addCDataSection("< 1000"); + inputEntry.setText(text); + rule.getInputEntries().add(inputEntry); + outputEntry = generateElement(OutputEntry.class, 3); + text = generateElement(Text.class); + text.setTextContent("\"ok\""); + outputEntry.setText(text); + rule.getOutputEntries().add(outputEntry); + outputEntry = generateElement(OutputEntry.class, 4); + text = generateElement(Text.class); + text.setTextContent("\"you little fish will get what you want\""); + outputEntry.setText(text); + rule.getOutputEntries().add(outputEntry); + decisionTable.getRules().add(rule); + + // 3. Rule + rule = generateElement(Rule.class, 3); + inputEntry = generateElement(InputEntry.class, 5); + text = generateElement(Text.class); + text.setTextContent("\"silver\""); + inputEntry.setText(text); + rule.getInputEntries().add(inputEntry); + inputEntry = generateElement(InputEntry.class, 6); + text = generateElement(Text.class); + text.getDomElement().addCDataSection(">= 1000"); + inputEntry.setText(text); + rule.getInputEntries().add(inputEntry); + outputEntry = generateElement(OutputEntry.class, 5); + text = generateElement(Text.class); + text.setTextContent("\"notok\""); + outputEntry.setText(text); + rule.getOutputEntries().add(outputEntry); + outputEntry = generateElement(OutputEntry.class, 6); + text = generateElement(Text.class); + text.setTextContent("\"you took too much man, you took too much!\""); + outputEntry.setText(text); + rule.getOutputEntries().add(outputEntry); + decisionTable.getRules().add(rule); + + // 4. Rule + rule = generateElement(Rule.class, 4); + inputEntry = generateElement(InputEntry.class, 7); + text = generateElement(Text.class); + text.setTextContent("\"gold\""); + inputEntry.setText(text); + rule.getInputEntries().add(inputEntry); + inputEntry = generateElement(InputEntry.class, 8); + text = generateElement(Text.class); + text.setTextContent(""); + inputEntry.setText(text); + rule.getInputEntries().add(inputEntry); + outputEntry = generateElement(OutputEntry.class, 7); + text = generateElement(Text.class); + text.setTextContent("\"ok\""); + outputEntry.setText(text); + rule.getOutputEntries().add(outputEntry); + outputEntry = generateElement(OutputEntry.class, 8); + text = generateElement(Text.class); + text.setTextContent("\"you get anything you want\""); + outputEntry.setText(text); + rule.getOutputEntries().add(outputEntry); + decisionTable.getRules().add(rule); + + assertModelEqualsFile(EXAMPLE_DMN); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/ExpressionLanguageTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/ExpressionLanguageTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b935ee3eeece3a44a2ba87561cb5710ee8ff055d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/ExpressionLanguageTest.java @@ -0,0 +1,106 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.camunda.bpm.model.dmn.instance.Decision; +import org.camunda.bpm.model.dmn.instance.DecisionTable; +import org.camunda.bpm.model.dmn.instance.Definitions; +import org.camunda.bpm.model.dmn.instance.Input; +import org.camunda.bpm.model.dmn.instance.InputEntry; +import org.camunda.bpm.model.dmn.instance.InputExpression; +import org.camunda.bpm.model.dmn.instance.InputValues; +import org.camunda.bpm.model.dmn.instance.Output; +import org.camunda.bpm.model.dmn.instance.OutputEntry; +import org.camunda.bpm.model.dmn.instance.OutputValues; +import org.camunda.bpm.model.dmn.instance.Rule; +import org.camunda.bpm.model.dmn.instance.Text; +import org.camunda.bpm.model.dmn.util.DmnModelResource; +import org.junit.Test; + +public class ExpressionLanguageTest extends DmnModelTest { + + public static final String EXPRESSION_LANGUAGE_DMN = "org/camunda/bpm/model/dmn/ExpressionLanguageTest.dmn"; + public static final String EXPRESSION_LANGUAGE = "juel"; + + + @Test + @DmnModelResource(resource = EXPRESSION_LANGUAGE_DMN) + public void shouldReadExpressionLanguage() { + Definitions definitions = modelInstance.getDefinitions(); + assertThat(definitions.getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE); + + DecisionTable decisionTable = modelInstance.getModelElementById("decisionTable"); + Input input = decisionTable.getInputs().iterator().next(); + assertThat(input.getInputExpression().getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE); + assertThat(input.getInputValues().getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE); + Output output = decisionTable.getOutputs().iterator().next(); + assertThat(output.getOutputValues().getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE); + + Rule rule = decisionTable.getRules().iterator().next(); + InputEntry inputEntry = rule.getInputEntries().iterator().next(); + assertThat(inputEntry.getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE); + OutputEntry outputEntry = rule.getOutputEntries().iterator().next(); + assertThat(outputEntry.getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE); + } + + @Test + public void shouldWriteExpressionLanguage() throws Exception { + modelInstance = Dmn.createEmptyModel(); + Definitions definitions = generateNamedElement(Definitions.class, "definitions"); + definitions.setNamespace(TEST_NAMESPACE); + definitions.setExpressionLanguage(EXPRESSION_LANGUAGE); + modelInstance.setDocumentElement(definitions); + + Decision decision = generateNamedElement(Decision.class, "Check Order"); + definitions.addChildElement(decision); + + DecisionTable decisionTable = generateElement(DecisionTable.class); + decision.addChildElement(decisionTable); + + Input input = generateElement(Input.class); + decisionTable.getInputs().add(input); + InputExpression inputExpression = generateElement(InputExpression.class); + inputExpression.setExpressionLanguage(EXPRESSION_LANGUAGE); + input.setInputExpression(inputExpression); + InputValues inputValues = generateElement(InputValues.class); + inputValues.setExpressionLanguage(EXPRESSION_LANGUAGE); + inputValues.setText(generateElement(Text.class)); + input.setInputValues(inputValues); + + Output output = generateElement(Output.class); + decisionTable.getOutputs().add(output); + OutputValues outputValues = generateElement(OutputValues.class); + outputValues.setExpressionLanguage(EXPRESSION_LANGUAGE); + outputValues.setText(generateElement(Text.class)); + output.setOutputValues(outputValues); + + Rule rule = generateElement(Rule.class); + decisionTable.getRules().add(rule); + InputEntry inputEntry = generateElement(InputEntry.class); + inputEntry.setExpressionLanguage(EXPRESSION_LANGUAGE); + inputEntry.setText(generateElement(Text.class)); + rule.getInputEntries().add(inputEntry); + OutputEntry outputEntry = generateElement(OutputEntry.class); + outputEntry.setExpressionLanguage(EXPRESSION_LANGUAGE); + rule.getOutputEntries().add(outputEntry); + + assertModelEqualsFile(EXPRESSION_LANGUAGE_DMN); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/GenerateIdTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/GenerateIdTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5f41a4a1098343db3817660f0fb3d88b79263115 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/GenerateIdTest.java @@ -0,0 +1,61 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.camunda.bpm.model.dmn.instance.Decision; +import org.camunda.bpm.model.dmn.instance.DecisionTable; +import org.camunda.bpm.model.dmn.instance.Definitions; +import org.camunda.bpm.model.dmn.instance.Output; +import org.junit.Test; + +public class GenerateIdTest { + + @Test + public void shouldNotGenerateIdsOnRead() { + DmnModelInstance modelInstance = Dmn.readModelFromStream(GenerateIdTest.class.getResourceAsStream("GenerateIdTest.dmn")); + Definitions definitions = modelInstance.getDefinitions(); + assertThat(definitions.getId()).isNull(); + + Decision decision = modelInstance.getModelElementsByType(Decision.class).iterator().next(); + assertThat(decision.getId()).isNull(); + + DecisionTable decisionTable = modelInstance.getModelElementsByType(DecisionTable.class).iterator().next(); + assertThat(decisionTable.getId()).isNull(); + + Output output = modelInstance.getModelElementsByType(Output.class).iterator().next(); + assertThat(output.getId()).isNull(); + } + + @Test + public void shouldGenerateIdsOnCreate() { + DmnModelInstance modelInstance = Dmn.createEmptyModel(); + Definitions definitions = modelInstance.newInstance(Definitions.class); + assertThat(definitions.getId()).isNotNull(); + + Decision decision = modelInstance.newInstance(Decision.class); + assertThat(decision.getId()).isNotNull(); + + DecisionTable decisionTable = modelInstance.newInstance(DecisionTable.class); + assertThat(decisionTable.getId()).isNotNull(); + + Output output = modelInstance.newInstance(Output.class); + assertThat(output.getId()).isNotNull(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/ReadWriteTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/ReadWriteTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e1408d97bbc7939ae66cf8cc1e867389546d4203 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/ReadWriteTest.java @@ -0,0 +1,242 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.bpm.model.dmn.DecisionTableOrientation.CrossTable; +import static org.camunda.bpm.model.dmn.DecisionTableOrientation.Rule_as_Column; +import static org.camunda.bpm.model.dmn.DecisionTableOrientation.Rule_as_Row; +import static org.camunda.bpm.model.dmn.HitPolicy.ANY; +import static org.camunda.bpm.model.dmn.HitPolicy.COLLECT; +import static org.camunda.bpm.model.dmn.HitPolicy.FIRST; +import static org.camunda.bpm.model.dmn.HitPolicy.OUTPUT_ORDER; +import static org.camunda.bpm.model.dmn.HitPolicy.PRIORITY; +import static org.camunda.bpm.model.dmn.HitPolicy.RULE_ORDER; +import static org.camunda.bpm.model.dmn.HitPolicy.UNIQUE; + +import org.camunda.bpm.model.dmn.impl.instance.InputDataImpl; +import org.camunda.bpm.model.dmn.instance.*; +import org.camunda.bpm.model.dmn.util.DmnModelResource; +import org.junit.Test; + +import java.util.Collection; + +public class ReadWriteTest extends DmnModelTest { + + public static final String DECISION_TABLE_ORIENTATION_DMN = "org/camunda/bpm/model/dmn/ReadWriteTest.decisionTableOrientation.dmn"; + public static final String HIT_POLICY_DMN = "org/camunda/bpm/model/dmn/ReadWriteTest.hitPolicy.dmn"; + public static final String INPUT_DATA_DMN = "org/camunda/bpm/model/dmn/ReadWriteTest.inputData.dmn"; + + @Test + @DmnModelResource(resource = DECISION_TABLE_ORIENTATION_DMN) + public void shouldReadDecisionTableOrientation() { + // Default + DecisionTable decisionTable = modelInstance.getModelElementById("decisionTable1"); + assertThat(decisionTable.getPreferredOrientation()).isEqualTo(Rule_as_Row); + + // Rule-as-Row + decisionTable = modelInstance.getModelElementById("decisionTable2"); + assertThat(decisionTable.getPreferredOrientation()).isEqualTo(Rule_as_Row); + + // Rule-as-Column + decisionTable = modelInstance.getModelElementById("decisionTable3"); + assertThat(decisionTable.getPreferredOrientation()).isEqualTo(Rule_as_Column); + + // CrossTable + decisionTable = modelInstance.getModelElementById("decisionTable4"); + assertThat(decisionTable.getPreferredOrientation()).isEqualTo(CrossTable); + } + + @Test + public void shouldWriteDecisionTableOrientation() throws Exception { + modelInstance = Dmn.createEmptyModel(); + Definitions definitions = generateNamedElement(Definitions.class, "definitions"); + definitions.setNamespace(TEST_NAMESPACE); + modelInstance.setDocumentElement(definitions); + + // Default + Decision decision = generateNamedElement(Decision.class, "decision1", 1); + DecisionTable decisionTable = generateElement(DecisionTable.class, 1); + decision.setExpression(decisionTable); + Output output = generateElement(Output.class, 1); + decisionTable.getOutputs().add(output); + definitions.addChildElement(decision); + + // Rule-as-Row + decision = generateNamedElement(Decision.class, "decision2", 2); + decisionTable = generateElement(DecisionTable.class, 2); + decisionTable.setPreferredOrientation(Rule_as_Row); + decision.setExpression(decisionTable); + output = generateElement(Output.class, 2); + decisionTable.getOutputs().add(output); + definitions.addChildElement(decision); + + // Rule-as-Column + decision = generateNamedElement(Decision.class, "decision3", 3); + decisionTable = generateElement(DecisionTable.class, 3); + decisionTable.setPreferredOrientation(Rule_as_Column); + decision.setExpression(decisionTable); + output = generateElement(Output.class, 3); + decisionTable.getOutputs().add(output); + definitions.addChildElement(decision); + + // CrossTable + decision = generateNamedElement(Decision.class, "decision4", 4); + decisionTable = generateElement(DecisionTable.class, 4); + decisionTable.setPreferredOrientation(CrossTable); + decision.setExpression(decisionTable); + output = generateElement(Output.class, 4); + decisionTable.getOutputs().add(output); + definitions.addChildElement(decision); + + assertModelEqualsFile(DECISION_TABLE_ORIENTATION_DMN); + } + + @Test + @DmnModelResource(resource = HIT_POLICY_DMN) + public void shouldReadHitPolicy() { + // Default + DecisionTable decisionTable = modelInstance.getModelElementById("decisionTable1"); + assertThat(decisionTable.getHitPolicy()).isEqualTo(UNIQUE); + + // UNIQUE + decisionTable = modelInstance.getModelElementById("decisionTable2"); + assertThat(decisionTable.getHitPolicy()).isEqualTo(UNIQUE); + + // FIRST + decisionTable = modelInstance.getModelElementById("decisionTable3"); + assertThat(decisionTable.getHitPolicy()).isEqualTo(FIRST); + + // PRIORITY + decisionTable = modelInstance.getModelElementById("decisionTable4"); + assertThat(decisionTable.getHitPolicy()).isEqualTo(PRIORITY); + + // ANY + decisionTable = modelInstance.getModelElementById("decisionTable5"); + assertThat(decisionTable.getHitPolicy()).isEqualTo(ANY); + + // COLLECT + decisionTable = modelInstance.getModelElementById("decisionTable6"); + assertThat(decisionTable.getHitPolicy()).isEqualTo(COLLECT); + + // RULE ORDER + decisionTable = modelInstance.getModelElementById("decisionTable7"); + assertThat(decisionTable.getHitPolicy()).isEqualTo(RULE_ORDER); + + // OUTPUT ORDER + decisionTable = modelInstance.getModelElementById("decisionTable8"); + assertThat(decisionTable.getHitPolicy()).isEqualTo(OUTPUT_ORDER); + + } + + @Test + public void shouldWriteHitPolicy() throws Exception { + modelInstance = Dmn.createEmptyModel(); + Definitions definitions = generateNamedElement(Definitions.class, "definitions"); + definitions.setNamespace(TEST_NAMESPACE); + modelInstance.setDocumentElement(definitions); + + // Default + Decision decision = generateNamedElement(Decision.class, "decision1", 1); + DecisionTable decisionTable = generateElement(DecisionTable.class, 1); + decision.setExpression(decisionTable); + Output output = generateElement(Output.class, 1); + decisionTable.getOutputs().add(output); + definitions.addChildElement(decision); + + // UNIQUE + decision = generateNamedElement(Decision.class, "decision2", 2); + decisionTable = generateElement(DecisionTable.class, 2); + decisionTable.setHitPolicy(UNIQUE); + decision.setExpression(decisionTable); + output = generateElement(Output.class, 2); + decisionTable.getOutputs().add(output); + definitions.addChildElement(decision); + + // FIRST + decision = generateNamedElement(Decision.class, "decision3", 3); + decisionTable = generateElement(DecisionTable.class, 3); + decisionTable.setHitPolicy(FIRST); + decision.setExpression(decisionTable); + output = generateElement(Output.class, 3); + decisionTable.getOutputs().add(output); + definitions.addChildElement(decision); + + // PRIORITY + decision = generateNamedElement(Decision.class, "decision4", 4); + decisionTable = generateElement(DecisionTable.class, 4); + decisionTable.setHitPolicy(PRIORITY); + decision.setExpression(decisionTable); + output = generateElement(Output.class, 4); + decisionTable.getOutputs().add(output); + definitions.addChildElement(decision); + + // ANY + decision = generateNamedElement(Decision.class, "decision5", 5); + decisionTable = generateElement(DecisionTable.class, 5); + decisionTable.setHitPolicy(ANY); + decision.setExpression(decisionTable); + output = generateElement(Output.class, 5); + decisionTable.getOutputs().add(output); + definitions.addChildElement(decision); + + // COLLECT + decision = generateNamedElement(Decision.class, "decision6", 6); + decisionTable = generateElement(DecisionTable.class, 6); + decisionTable.setHitPolicy(COLLECT); + decision.setExpression(decisionTable); + output = generateElement(Output.class, 6); + decisionTable.getOutputs().add(output); + definitions.addChildElement(decision); + + // RULE ORDER + decision = generateNamedElement(Decision.class, "decision7", 7); + decisionTable = generateElement(DecisionTable.class, 7); + decisionTable.setHitPolicy(RULE_ORDER); + decision.setExpression(decisionTable); + output = generateElement(Output.class, 7); + decisionTable.getOutputs().add(output); + definitions.addChildElement(decision); + + // OUTPUT ORDER + decision = generateNamedElement(Decision.class, "decision8", 8); + decisionTable = generateElement(DecisionTable.class, 8); + decisionTable.setHitPolicy(OUTPUT_ORDER); + decision.setExpression(decisionTable); + output = generateElement(Output.class, 8); + decisionTable.getOutputs().add(output); + definitions.addChildElement(decision); + + assertModelEqualsFile(HIT_POLICY_DMN); + + } + + @Test + @DmnModelResource(resource = INPUT_DATA_DMN) + public void shouldReadInputData() { + + Collection inputDataCollection = modelInstance.getModelElementsByType(InputData.class); + + assertThat(inputDataCollection).hasSize(2); + assertThat(inputDataCollection).extracting("class").contains(InputDataImpl.class); + + InputData inputData = modelInstance.getModelElementById("customerStatusIn"); + + assertThat(inputData).isNotNull(); + assertThat(inputData).isInstanceOf(InputData.class); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AbstractDmnElementReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AbstractDmnElementReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..402b7fe3527bd8386057b765f39521b33c7b0297 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AbstractDmnElementReferenceTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public abstract class AbstractDmnElementReferenceTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DmnElementReference.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AbstractTextContentElementTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AbstractTextContentElementTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e45145f9bea6437e218907d2813545bb922fdabf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AbstractTextContentElementTest.java @@ -0,0 +1,34 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public abstract class AbstractTextContentElementTest extends DmnModelElementInstanceTest { + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AllowedAnswersTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AllowedAnswersTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6992e1d731095be84ae9bf4f2d5c26e565d230e3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AllowedAnswersTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class AllowedAnswersTest extends AbstractTextContentElementTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AllowedValuesTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AllowedValuesTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1a2734a6267f21cddcc5890f6585e18d29034f07 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AllowedValuesTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class AllowedValuesTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(LiteralExpression.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ArtifactTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ArtifactTest.java new file mode 100644 index 0000000000000000000000000000000000000000..12a6cf8f6de9bf1f5c4afab60a82ff0443bfdefa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ArtifactTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class ArtifactTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DmnElement.class, true); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AssociationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AssociationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..65587ab2c118947d03485d5bc7a9c303730593e5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AssociationTest.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.dmn.AssociationDirection; + +public class AssociationTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Artifact.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(SourceRef.class, 1, 1), + new ChildElementAssumption(TargetRef.class, 1, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("associationDirection", false, false, AssociationDirection.None) + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AuthorityRequirementTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AuthorityRequirementTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9a0a50ad5c3739bae69224b8fd5fff2d457f2907 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/AuthorityRequirementTest.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class AuthorityRequirementTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(RequiredDecisionReference.class, 0, 1), + new ChildElementAssumption(RequiredInputReference.class, 0, 1), + new ChildElementAssumption(RequiredAuthorityReference.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/BindingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/BindingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f93f6af2e57f1135dc901a90e326993506697113 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/BindingTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class BindingTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Parameter.class, 1, 1), + new ChildElementAssumption(Expression.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/BusinessContextElementTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/BusinessContextElementTest.java new file mode 100644 index 0000000000000000000000000000000000000000..50585994ca9c4bd2cb33450c08eb307c3ac7b5b1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/BusinessContextElementTest.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class BusinessContextElementTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(NamedElement.class, true); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("URI") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/BusinessKnowledgeModelTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/BusinessKnowledgeModelTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bbfd9e6b56fc3be2c1136de0e7678ea439846fcd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/BusinessKnowledgeModelTest.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class BusinessKnowledgeModelTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DrgElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(EncapsulatedLogic.class, 0, 1), + new ChildElementAssumption(Variable.class, 0, 1), + new ChildElementAssumption(KnowledgeRequirement.class), + new ChildElementAssumption(AuthorityRequirement.class) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ColumnTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ColumnTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b563b9b50b891ea7e0ca12c75679fe8b423123b9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ColumnTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class ColumnTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(InformationItem.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ContextEntryTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ContextEntryTest.java new file mode 100644 index 0000000000000000000000000000000000000000..8f3bbaf3b36b7f18f6130e052866d76c4680a667 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ContextEntryTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class ContextEntryTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Variable.class, 0, 1), + new ChildElementAssumption(Expression.class, 1, 1) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ContextTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ContextTest.java new file mode 100644 index 0000000000000000000000000000000000000000..05f83091196c62cc9410df62618620387b557dd3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ContextTest.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class ContextTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Expression.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(ContextEntry.class) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionMadeReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionMadeReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..13e56447f563b5efb6433530ec4e15720a620487 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionMadeReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class DecisionMadeReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionMakerReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionMakerReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..33d6a6c47e04e3b08850cbce4e4d5d33611762a0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionMakerReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class DecisionMakerReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionOwnedReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionOwnedReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7cda523acfd210729f65a10379c8565660d50c34 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionOwnedReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class DecisionOwnedReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionOwnerReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionOwnerReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0e0cf9eed8c54a9eaf029599b72dbcf6d189db7f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionOwnerReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class DecisionOwnerReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionRuleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionRuleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..67a47a1e3e736ebae31797d06ba2162b9c33d1c7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionRuleTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class DecisionRuleTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(InputEntry.class), + new ChildElementAssumption(OutputEntry.class, 1) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionServiceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionServiceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f249f9942ddd34661c0fbeeb02558fbef0440714 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionServiceTest.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class DecisionServiceTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(NamedElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(OutputDecisionReference.class, 1), + new ChildElementAssumption(EncapsulatedDecisionReference.class), + new ChildElementAssumption(InputDecisionReference.class), + new ChildElementAssumption(InputDataReference.class) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionTableTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionTableTest.java new file mode 100644 index 0000000000000000000000000000000000000000..27758b3c0616f419d0a0cdfcf85972ce986a5b0e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionTableTest.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +import org.camunda.bpm.model.dmn.DecisionTableOrientation; +import org.camunda.bpm.model.dmn.HitPolicy; + +public class DecisionTableTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Expression.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Input.class), + new ChildElementAssumption(Output.class, 1), + new ChildElementAssumption(Rule.class) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("hitPolicy", false, false, HitPolicy.UNIQUE), + new AttributeAssumption("aggregation"), + new AttributeAssumption("preferredOrientation", false, false, DecisionTableOrientation.Rule_as_Row), + new AttributeAssumption("outputLabel") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..cd1b623c06cfddb3a3ee8a24a5e068ee8f62022d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DecisionTest.java @@ -0,0 +1,54 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.CAMUNDA_NS; + +public class DecisionTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DrgElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Question.class, 0, 1), + new ChildElementAssumption(AllowedAnswers.class, 0, 1), + new ChildElementAssumption(Variable.class, 0, 1), + new ChildElementAssumption(InformationRequirement.class), + new ChildElementAssumption(KnowledgeRequirement.class), + new ChildElementAssumption(AuthorityRequirement.class), + new ChildElementAssumption(SupportedObjectiveReference.class), + new ChildElementAssumption(ImpactedPerformanceIndicatorReference.class), + new ChildElementAssumption(DecisionMakerReference.class), + new ChildElementAssumption(DecisionOwnerReference.class), + new ChildElementAssumption(UsingProcessReference.class), + new ChildElementAssumption(UsingTaskReference.class), + new ChildElementAssumption(Expression.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption(CAMUNDA_NS, "versionTag"), + new AttributeAssumption(CAMUNDA_NS, "historyTimeToLive") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DefaultOutputEntryTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DefaultOutputEntryTest.java new file mode 100644 index 0000000000000000000000000000000000000000..33b7c116de148fc3571eced4bcdfd941e00e4285 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DefaultOutputEntryTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class DefaultOutputEntryTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(LiteralExpression.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DefinitionsTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DefinitionsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..561045467530ab224bab9fd85f661a0c1fe58f96 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DefinitionsTest.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class DefinitionsTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(NamedElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Import.class), + new ChildElementAssumption(ItemDefinition.class), + new ChildElementAssumption(DrgElement.class), + new ChildElementAssumption(Artifact.class), + new ChildElementAssumption(ElementCollection.class), + new ChildElementAssumption(BusinessContextElement.class) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("expressionLanguage", false, false, "http://www.omg.org/spec/FEEL/20140401"), + new AttributeAssumption("typeLanguage", false, false, "http://www.omg.org/spec/FEEL/20140401"), + new AttributeAssumption("namespace", false, true), + new AttributeAssumption("exporter"), + new AttributeAssumption("exporterVersion") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DescriptionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DescriptionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0da01e1c49659541d99e284f231c2ac871ed6c5d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DescriptionTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class DescriptionTest extends AbstractTextContentElementTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DmnElementReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DmnElementReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..92a52320680ca90c4a1becbf768e0811c8fc8ea8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DmnElementReferenceTest.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class DmnElementReferenceTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("href", false, true) + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DmnElementTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DmnElementTest.java new file mode 100644 index 0000000000000000000000000000000000000000..8ac9274a61be68f87ea355942850699dc10c30dd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DmnElementTest.java @@ -0,0 +1,42 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class DmnElementTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(true); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Description.class, 0, 1), + new ChildElementAssumption(ExtensionElements.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("id", true), + new AttributeAssumption("label") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DmnModelElementInstanceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DmnModelElementInstanceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..56cc3359b32348606202aaf1ed1892e044fe26b6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DmnModelElementInstanceTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import org.camunda.bpm.model.dmn.impl.DmnModelConstants; +import org.camunda.bpm.model.dmn.util.GetDmnModelElementTypeRule; +import org.camunda.bpm.model.xml.test.AbstractModelElementInstanceTest; +import org.junit.BeforeClass; +import org.junit.ClassRule; + +public abstract class DmnModelElementInstanceTest extends AbstractModelElementInstanceTest { + + @ClassRule + public static final GetDmnModelElementTypeRule modelElementTypeRule = new GetDmnModelElementTypeRule(); + + @BeforeClass + public static void initModelElementType() { + initModelElementType(modelElementTypeRule); + } + + public String getDefaultNamespace() { + return DmnModelConstants.LATEST_DMN_NS; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DrgElementReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DrgElementReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6d55de5187e423cfc8b4adc513b47b27099bc552 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DrgElementReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class DrgElementReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DrgElementTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DrgElementTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bf525b72e8d367c53bbb7cc9450c20a475e8da38 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/DrgElementTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class DrgElementTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(NamedElement.class, true); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ElementCollectionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ElementCollectionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ae634a746aa045c35431d2d3c9069d8b79ed56d1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ElementCollectionTest.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class ElementCollectionTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(NamedElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(DrgElementReference.class) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/EncapsulatedDecisionReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/EncapsulatedDecisionReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..41b836e7c61e32c0f2f774810cf4fd76e35c6803 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/EncapsulatedDecisionReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class EncapsulatedDecisionReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/EncapsulatedLogicTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/EncapsulatedLogicTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9a35703bba427eb8b94807fa474948302f50de2f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/EncapsulatedLogicTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class EncapsulatedLogicTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(FunctionDefinition.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ExpressionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ExpressionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ec9460762f4379a90c584b3d1fd9137b8b855403 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ExpressionTest.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class ExpressionTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DmnElement.class, true); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("typeRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ExtensionElementsTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ExtensionElementsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0d490f25642fba023a299c0cf1eb327b95574faf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ExtensionElementsTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class ExtensionElementsTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/FormalParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/FormalParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..65abfcf0543ee0fcf8accee9eff20e7d7aac6ddc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/FormalParameterTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class FormalParameterTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(InformationItem.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/FunctionDefinitionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/FunctionDefinitionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..af1906b4cc6ecb6152e95a2901b3087ce8d7fd6c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/FunctionDefinitionTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class FunctionDefinitionTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Expression.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(FormalParameter.class), + new ChildElementAssumption(Expression.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImpactedPerformanceIndicatorReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImpactedPerformanceIndicatorReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ab7376a80baf23e4706696e2b93bd9b574dd0e73 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImpactedPerformanceIndicatorReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class ImpactedPerformanceIndicatorReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImpactingDecisionReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImpactingDecisionReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..99944865b073d15a35489f097cd1ac8c57d83207 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImpactingDecisionReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class ImpactingDecisionReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e88364aa87c52a4e2a40e18f59cf93d6178788e1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImportTest.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class ImportTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("namespace", false, true), + new AttributeAssumption("locationURI"), + new AttributeAssumption("importType", false, true) + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImportedElementTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImportedElementTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a7e90084c5c47fd22c61f090999b3744992b638c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImportedElementTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class ImportedElementTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImportedValuesTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImportedValuesTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bcfedfe85e44cc19798a703ea0344d723ee21944 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ImportedValuesTest.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class ImportedValuesTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Import.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(ImportedElement.class, 1, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("expressionLanguage") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InformationItemTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InformationItemTest.java new file mode 100644 index 0000000000000000000000000000000000000000..98ac7cbb3d6fb79d3bb5b705d1d1bd169ac88164 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InformationItemTest.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class InformationItemTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(NamedElement.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("typeRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InformationRequirementTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InformationRequirementTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d67d0aab3a53383f7bf012740c5b64735d5a9f37 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InformationRequirementTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class InformationRequirementTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(RequiredDecisionReference.class, 0, 1), + new ChildElementAssumption(RequiredInputReference.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputClauseTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputClauseTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d0bebd97f589aef5f9d7d381e0fb12f78f51378e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputClauseTest.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.CAMUNDA_NS; + +import java.util.Arrays; +import java.util.Collection; + +public class InputClauseTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(InputExpression.class, 1, 1), + new ChildElementAssumption(InputValues.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + // camunda extensions + new AttributeAssumption(CAMUNDA_NS, "inputVariable") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputDataReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputDataReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1fe99628250bcab85171ead72fbc7f5544eb23a1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputDataReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class InputDataReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputDataTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputDataTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c02534da9854f46eba4c2b622e7b4c5d73956a59 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputDataTest.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class InputDataTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DrgElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(InformationItem.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputDecisionReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputDecisionReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..cac57e4aff9f0b8d883ed26acdc051567f7c719e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputDecisionReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class InputDecisionReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputEntryTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputEntryTest.java new file mode 100644 index 0000000000000000000000000000000000000000..89dec17c21e4b43472e6e33586ff5b527563d64a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputEntryTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class InputEntryTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(UnaryTests.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputExpressionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputExpressionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ee212c0e5d43797e38f8d4a9c375cb8b70562043 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputExpressionTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class InputExpressionTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(LiteralExpression.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c6ea8a8c317678153a93616e16fc9e2d32dec711 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class InputTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(InputClause.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputValuesTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputValuesTest.java new file mode 100644 index 0000000000000000000000000000000000000000..48732e68c7ba5df1b4c76cd501f122f0f65fae87 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InputValuesTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class InputValuesTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(UnaryTests.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InvocationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InvocationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1544fd26158706200f12daf2098da70853d0ae2a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/InvocationTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class InvocationTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Expression.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Expression.class, 0, 1), + new ChildElementAssumption(Binding.class) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ItemComponentTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ItemComponentTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2eff0b11037f2f5f18346d84034eb63646b88272 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ItemComponentTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class ItemComponentTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(ItemDefinition.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ItemDefinitionReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ItemDefinitionReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ecdeada50c0a85622bbc484b1c64583cec830b13 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ItemDefinitionReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class ItemDefinitionReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ItemDefinitionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ItemDefinitionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..617b719d416d21e16fa22b7d5d300a7302ba6316 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ItemDefinitionTest.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class ItemDefinitionTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(NamedElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(TypeRef.class, 0, 1), + new ChildElementAssumption(AllowedValues.class, 0, 1), + new ChildElementAssumption(ItemComponent.class) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("typeLanguage"), + new AttributeAssumption("isCollection", false, false, false) + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/KnowledgeRequirementTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/KnowledgeRequirementTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3726e56d80c740c83b6798a59a37e9dffa5a8692 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/KnowledgeRequirementTest.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class KnowledgeRequirementTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(RequiredKnowledgeReference.class, 1, 1) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/KnowledgeSourceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/KnowledgeSourceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..41eace06fb5e878ac3bca19f83c8f6c0e319a632 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/KnowledgeSourceTest.java @@ -0,0 +1,42 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class KnowledgeSourceTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DrgElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(AuthorityRequirement.class), + new ChildElementAssumption(Type.class, 0, 1), + new ChildElementAssumption(OwnerReference.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("locationURI") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ListTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ListTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5ed72e1e82d804186ddf3dd681158b55257b3bde --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ListTest.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class ListTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Expression.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Expression.class) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/LiteralExpressionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/LiteralExpressionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..60dedd306672cb28a062a7cc64ff6cd3570de226 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/LiteralExpressionTest.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class LiteralExpressionTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Expression.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Text.class, 0, 1), + new ChildElementAssumption(ImportedValues.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("expressionLanguage") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/NamedElementTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/NamedElementTest.java new file mode 100644 index 0000000000000000000000000000000000000000..53ebee7d4b204da2299d6b4d4808ea9c13cf6f57 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/NamedElementTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class NamedElementTest extends DmnModelElementInstanceTest { + + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DmnElement.class, true); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name", false, true) + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OrganizationUnitTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OrganizationUnitTest.java new file mode 100644 index 0000000000000000000000000000000000000000..72a9f93d573cad730aea7895dd0367b95f43e276 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OrganizationUnitTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class OrganizationUnitTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(BusinessContextElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(DecisionMadeReference.class), + new ChildElementAssumption(DecisionOwnedReference.class) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputClauseTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputClauseTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7257133c98c875142cdd9e27525b743f2be3187e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputClauseTest.java @@ -0,0 +1,42 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class OutputClauseTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(OutputValues.class, 0, 1), + new ChildElementAssumption(DefaultOutputEntry.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("name"), + new AttributeAssumption("typeRef") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputDecisionReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputDecisionReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..23fb1f087d0836f0b46fe563f85e897345906069 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputDecisionReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class OutputDecisionReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputEntryTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputEntryTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2205c7611ca46889a14ffe5ef8c3d37f5edeaa43 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputEntryTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class OutputEntryTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(LiteralExpression.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputTest.java new file mode 100644 index 0000000000000000000000000000000000000000..dbd3445367a36e3b50c3cd03224c3dd6ff3358f7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class OutputTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(OutputClause.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputValuesTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputValuesTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a21d68d14aa7969866a115c8ef27e91f2caf8ead --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OutputValuesTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class OutputValuesTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(UnaryTests.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OwnerReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OwnerReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..08bfb94fe0159ed937e9748382cfbc0d70a551f3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/OwnerReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class OwnerReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ParameterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ParameterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3a2e22c286804e778fa6c4fc1e10f448d970a89d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/ParameterTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class ParameterTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(InformationItem.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/PerformanceIndicatorTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/PerformanceIndicatorTest.java new file mode 100644 index 0000000000000000000000000000000000000000..85224d2a3e1d57c703e0da0dcbe81c772b1ccd2e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/PerformanceIndicatorTest.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class PerformanceIndicatorTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(BusinessContextElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(ImpactingDecisionReference.class) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/QuestionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/QuestionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..49dcd701aa1769f0a224acf92d1ffea3b817cc35 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/QuestionTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class QuestionTest extends AbstractTextContentElementTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RelationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RelationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b139700ea5e9803764e010c5872a50cc472e8553 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RelationTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class RelationTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Expression.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Column.class), + new ChildElementAssumption(Row.class) + ); + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RequiredAuthorityReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RequiredAuthorityReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4326fd73e2b26d458275bd0ff77136c05e432853 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RequiredAuthorityReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class RequiredAuthorityReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RequiredDecisionReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RequiredDecisionReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d00963c611d740277c12a2e8087d2dfbe2016c62 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RequiredDecisionReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class RequiredDecisionReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RequiredInputReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RequiredInputReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..fc38436ed8459e23fa67dbbefd42ed653ae81f0d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RequiredInputReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class RequiredInputReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RequiredKnowledgeReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RequiredKnowledgeReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e2386e6073597047b6de65d45a2e56b93a4b450f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RequiredKnowledgeReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class RequiredKnowledgeReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RowTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RowTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d652ab8190c142d8b637f017231dd3ae6e2acacf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RowTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class RowTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(List.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RuleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RuleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..81b5cecd2b1025e5d9bdadb214cbd74c132b22aa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/RuleTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class RuleTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DecisionRule.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/SourceRefTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/SourceRefTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b0674cf71eba82cff59439fc7a66caa30a65e551 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/SourceRefTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class SourceRefTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/SupportedObjectiveReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/SupportedObjectiveReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a35d025ce7ac0caa6c03919da882806b5407d9b5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/SupportedObjectiveReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class SupportedObjectiveReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TargetRefTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TargetRefTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a3181ec51ce1648f6f2ddaa51e30419bda5f4c29 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TargetRefTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class TargetRefTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TextAnnotationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TextAnnotationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..375a7583525261a020d6bf3cf3f45d4e53cdadb2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TextAnnotationTest.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class TextAnnotationTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(Artifact.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Text.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("textFormat", false, false, "text/plain") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TextTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TextTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a8497ed9b80f6245e4b6730ad3c412ae05ebf0b8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TextTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class TextTest extends AbstractTextContentElementTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TypeRefTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TypeRefTest.java new file mode 100644 index 0000000000000000000000000000000000000000..8157258242fcb2cefb431ab68ef611d82d0d4711 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TypeRefTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class TypeRefTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TypeTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TypeTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3036eb0f152fa13795e5e17b83e441c3f846c242 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/TypeTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class TypeTest extends AbstractTextContentElementTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/UnaryTestsTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/UnaryTestsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1d4a6308d4529292b7f9af02ae12dfe62219e8ed --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/UnaryTestsTest.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Arrays; +import java.util.Collection; + +public class UnaryTestsTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(DmnElement.class, false); + } + + public Collection getChildElementAssumptions() { + return Arrays.asList( + new ChildElementAssumption(Text.class, 0, 1) + ); + } + + public Collection getAttributesAssumptions() { + return Arrays.asList( + new AttributeAssumption("expressionLanguage") + ); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/UsingProcessReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/UsingProcessReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..66388478a976ac99812116e6ff30e5a789356d01 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/UsingProcessReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class UsingProcessReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/UsingTaskReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/UsingTaskReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..766287946e1f406d37b42bfadd274f734013cd51 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/UsingTaskReferenceTest.java @@ -0,0 +1,21 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +public class UsingTaskReferenceTest extends AbstractDmnElementReferenceTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/VariableTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/VariableTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0254160a7fc828670f0f4acd825dc51c9c8ed3f9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/instance/VariableTest.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.instance; + +import java.util.Collection; + +public class VariableTest extends DmnModelElementInstanceTest { + + public TypeAssumption getTypeAssumption() { + return new TypeAssumption(InformationItem.class, false); + } + + public Collection getChildElementAssumptions() { + return null; + } + + public Collection getAttributesAssumptions() { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/util/DmnModelResource.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/util/DmnModelResource.java new file mode 100644 index 0000000000000000000000000000000000000000..e672019a1e1661a36d78547b77df1fbf0e6537f5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/util/DmnModelResource.java @@ -0,0 +1,30 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.util; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface DmnModelResource { + + String resource() default ""; + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/util/GetDmnModelElementTypeRule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/util/GetDmnModelElementTypeRule.java new file mode 100644 index 0000000000000000000000000000000000000000..c01ffedc1af0b65ea2efb68446db0daa5ba73af2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/util/GetDmnModelElementTypeRule.java @@ -0,0 +1,64 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.util; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.camunda.bpm.model.dmn.Dmn; +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.test.GetModelElementTypeRule; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; + +public class GetDmnModelElementTypeRule extends TestWatcher implements GetModelElementTypeRule { + + private ModelInstance modelInstance; + private Model model; + private ModelElementType modelElementType; + + @Override + @SuppressWarnings("unchecked") + protected void starting(Description description) { + String className = description.getClassName(); + assertThat(className).endsWith("Test"); + className = className.substring(0, className.length() - "Test".length()); + Class instanceClass; + try { + instanceClass = (Class) Class.forName(className); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + modelInstance = Dmn.createEmptyModel(); + model = modelInstance.getModel(); + modelElementType = model.getType(instanceClass); + } + + public ModelInstance getModelInstance() { + return modelInstance; + } + + public Model getModel() { + return model; + } + + public ModelElementType getModelElementType() { + return modelElementType; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/util/Java9CDataWhitespaceFilter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/util/Java9CDataWhitespaceFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..1aa0e8b89ae56d3686d225bec993e79a68611188 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/util/Java9CDataWhitespaceFilter.java @@ -0,0 +1,100 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.util; + +import org.w3c.dom.CDATASection; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; +import org.xmlunit.util.Predicate; + +/** + *

In Java 8, a CDATA section is serialized with pretty printing as + * + *

+ * {@code
+ * 
+ *   
+ * 
+ * }
+ * 
+ * + *

whereas in Java 9+ it becomes + * + *

+ * {@code
+ * 
+ *   
+ *      
+ *   
+ * 
+ *}
+ * 
+ * + *

Note that the bar element in the second example has three children: a text with whitespace, + * a cdata section and another text with whitespace. This is semantically different XML than the + * first example. + * + *

This filter detects this whitespace pattern and removes the whitespace text + * nodes before xmlunit performs the comparison. + * + * @see https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8223291 + */ +public class Java9CDataWhitespaceFilter implements Predicate { + + /** + * @return false to remove the node from the comparison + */ + @Override + public boolean test(Node toTest) { + return !isWhitespaceSurroundingCData(toTest); + } + + private boolean isWhitespaceSurroundingCData(Node node) { + + if (isWhitespaceTextNode(node)) { + Node parent = node.getParentNode(); + NodeList children = parent.getChildNodes(); + + if (children.getLength() == 3) { + Node child0 = children.item(0); + Node child1 = children.item(1); + Node child2 = children.item(2); + + return isTextNode(child0) && isCDataSection(child1) && isTextNode(child2); + } else { + return false; + } + + } else { + return false; + } + } + + private boolean isWhitespaceTextNode(Node node) + { + return isTextNode(node) && ((Text) node).getNodeValue().trim().isEmpty(); + } + + private boolean isTextNode(Node node) { + return node instanceof Text; + } + + private boolean isCDataSection(Node node) { + return node instanceof CDATASection; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/util/ParseDmnModelRule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/util/ParseDmnModelRule.java new file mode 100644 index 0000000000000000000000000000000000000000..d5e8fe5f79cfafcd139fff522a15b1a340c56222 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/java/org/camunda/bpm/model/dmn/util/ParseDmnModelRule.java @@ -0,0 +1,63 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.dmn.util; + +import java.io.InputStream; + +import org.camunda.bpm.model.dmn.Dmn; +import org.camunda.bpm.model.dmn.DmnModelInstance; +import org.camunda.bpm.model.xml.impl.util.IoUtil; +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; + +public class ParseDmnModelRule extends TestWatcher { + + protected DmnModelInstance dmnModelInstance; + + @Override + protected void starting(Description description) { + + DmnModelResource dmnModelResource = description.getAnnotation(DmnModelResource.class); + + if(dmnModelResource != null) { + + String resourcePath = dmnModelResource.resource(); + + if (resourcePath.isEmpty()) { + Class testClass = description.getTestClass(); + String methodName = description.getMethodName(); + + String resourceFolderName = testClass.getName().replaceAll("\\.", "/"); + resourcePath = resourceFolderName + "." + methodName + ".dmn"; + } + + InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream(resourcePath); + try { + dmnModelInstance = Dmn.readModelFromStream(resourceAsStream); + } finally { + IoUtil.closeSilently(resourceAsStream); + } + + } + + } + + public DmnModelInstance getDmnModel() { + return dmnModelInstance; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/CamundaExtensionsCompatibilityTest.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/CamundaExtensionsCompatibilityTest.dmn new file mode 100644 index 0000000000000000000000000000000000000000..50c597fa9a397ce8d62f11c0b48a2948e08bbf0c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/CamundaExtensionsCompatibilityTest.dmn @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/CamundaExtensionsTest.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/CamundaExtensionsTest.dmn new file mode 100644 index 0000000000000000000000000000000000000000..be17566b3e4011dd67a54e27303d7cc69caff900 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/CamundaExtensionsTest.dmn @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example-DMN-1.2.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example-DMN-1.2.dmn new file mode 100644 index 0000000000000000000000000000000000000000..0c8f5290c5d4297c98b624c4b1109a53677290b5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example-DMN-1.2.dmn @@ -0,0 +1,85 @@ + + + + + + + status + + + "bronze","silver","gold" + + + + + sum + + + + + "ok","notok" + + + + + + "bronze" + + + + + + "notok" + + + + + + + + "silver" + + + + + + "ok" + + + "you little fish will get what you want" + + + + + "silver" + + + = 1000]]> + + + "notok" + + + "you took too much man, you took too much!" + + + + + "gold" + + + + + + "ok" + + + "you get anything you want" + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example-DMN-1.3.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example-DMN-1.3.dmn new file mode 100644 index 0000000000000000000000000000000000000000..65abd6147101d46c63a46a0ba272e64064ef693e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example-DMN-1.3.dmn @@ -0,0 +1,85 @@ + + + + + + + status + + + "bronze","silver","gold" + + + + + sum + + + + + "ok","notok" + + + + + + "bronze" + + + + + + "notok" + + + + + + + + "silver" + + + + + + "ok" + + + "you little fish will get what you want" + + + + + "silver" + + + = 1000]]> + + + "notok" + + + "you took too much man, you took too much!" + + + + + "gold" + + + + + + "ok" + + + "you get anything you want" + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example-DMN-1.4.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example-DMN-1.4.dmn new file mode 100644 index 0000000000000000000000000000000000000000..d7cc9260e262637ca5d0626c2685699130e253e1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example-DMN-1.4.dmn @@ -0,0 +1,85 @@ + + + + + + + status + + + "bronze","silver","gold" + + + + + sum + + + + + "ok","notok" + + + + + + "bronze" + + + + + + "notok" + + + + + + + + "silver" + + + + + + "ok" + + + "you little fish will get what you want" + + + + + "silver" + + + = 1000]]> + + + "notok" + + + "you took too much man, you took too much!" + + + + + "gold" + + + + + + "ok" + + + "you get anything you want" + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example-DMN-1.5.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example-DMN-1.5.dmn new file mode 100644 index 0000000000000000000000000000000000000000..4dc6c0c937c4d1f34fb921009330c5bbfb419815 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example-DMN-1.5.dmn @@ -0,0 +1,85 @@ + + + + + + + status + + + "bronze","silver","gold" + + + + + sum + + + + + "ok","notok" + + + + + + "bronze" + + + + + + "notok" + + + + + + + + "silver" + + + + + + "ok" + + + "you little fish will get what you want" + + + + + "silver" + + + = 1000]]> + + + "notok" + + + "you took too much man, you took too much!" + + + + + "gold" + + + + + + "ok" + + + "you get anything you want" + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example.dmn new file mode 100644 index 0000000000000000000000000000000000000000..65abd6147101d46c63a46a0ba272e64064ef693e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/Example.dmn @@ -0,0 +1,85 @@ + + + + + + + status + + + "bronze","silver","gold" + + + + + sum + + + + + "ok","notok" + + + + + + "bronze" + + + + + + "notok" + + + + + + + + "silver" + + + + + + "ok" + + + "you little fish will get what you want" + + + + + "silver" + + + = 1000]]> + + + "notok" + + + "you took too much man, you took too much!" + + + + + "gold" + + + + + + "ok" + + + "you get anything you want" + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ExampleCompatibility.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ExampleCompatibility.dmn new file mode 100644 index 0000000000000000000000000000000000000000..488ef1a8daf973fbd4333f57eebb8ec9db7f679e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ExampleCompatibility.dmn @@ -0,0 +1,85 @@ + + + + + + + status + + + "bronze","silver","gold" + + + + + sum + + + + + "ok","notok" + + + + + + "bronze" + + + + + + "notok" + + + + + + + + "silver" + + + + + + "ok" + + + "you little fish will get what you want" + + + + + "silver" + + + = 1000]]> + + + "notok" + + + "you took too much man, you took too much!" + + + + + "gold" + + + + + + "ok" + + + "you get anything you want" + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ExampleWithCamundaDI.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ExampleWithCamundaDI.dmn new file mode 100644 index 0000000000000000000000000000000000000000..f6db1bf917dfdec8e105c1573d3788fd7b1f3c98 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ExampleWithCamundaDI.dmn @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + season + + + + + guestCount + + + + + + + + + + + + + + + + + + + + 8]]> + + + + + + + + + + + 10]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + =10]]> + + + + + + + + + + + + + + + + + + + + + + temperature + + + + + + 30]]> + + + + + + + + + + + + + + + + [10..30] + + + + + + + + + + + + + + + + + + + + + + dayType + + + + + + + + + 4 + + + + + + + + 10 + + + + + + + + 15 + + + + + \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ExpressionLanguageTest.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ExpressionLanguageTest.dmn new file mode 100644 index 0000000000000000000000000000000000000000..e72d35a24ca558da60f46e586a1386a4f3550139 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ExpressionLanguageTest.dmn @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/GenerateIdTest.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/GenerateIdTest.dmn new file mode 100644 index 0000000000000000000000000000000000000000..13894960a552ed12cbe8d13d57b803d44fe4c7a6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/GenerateIdTest.dmn @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/JDK9-style-CDATA.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/JDK9-style-CDATA.dmn new file mode 100644 index 0000000000000000000000000000000000000000..c3b6dc9dee1fee160e41864370983f272d9dc3d5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/JDK9-style-CDATA.dmn @@ -0,0 +1,21 @@ + + + + + + + + + + + + = 1000]]> + + + + "notok" + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ReadWriteTest.decisionTableOrientation.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ReadWriteTest.decisionTableOrientation.dmn new file mode 100644 index 0000000000000000000000000000000000000000..b44349a297177e9ac6e9e36cc3ced380cb6f5cef --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ReadWriteTest.decisionTableOrientation.dmn @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ReadWriteTest.hitPolicy.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ReadWriteTest.hitPolicy.dmn new file mode 100644 index 0000000000000000000000000000000000000000..7c6dade3e7de1bc2ae95328ffade60cb2c98b121 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ReadWriteTest.hitPolicy.dmn @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ReadWriteTest.inputData.dmn b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ReadWriteTest.inputData.dmn new file mode 100644 index 0000000000000000000000000000000000000000..bbe375820edd2c349d7071bf54b432b6a605eab6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/dmn-model/src/test/resources/org/camunda/bpm/model/dmn/ReadWriteTest.inputData.dmn @@ -0,0 +1,95 @@ + + + + + + + + + + status + + + + + + + + sum + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + = 1000]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..6d04cc8ac0432f96858dd81b4a17990d018742f0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + + org.camunda.bpm.model + camunda-model-apis + + camunda Model APIs + pom + + + Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/ + + + + org.camunda.bpm + camunda-database-settings + ../database + 7.24.0-SNAPSHOT + + + + + + org.camunda.bpm + camunda-core-internal-dependencies + ${project.version} + import + pom + + + + + + xml-model + bpmn-model + dmn-model + cmmn-model + + + \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/.clirr-jenkins-ignore.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/.clirr-jenkins-ignore.xml new file mode 100644 index 0000000000000000000000000000000000000000..a56634296b06545b74853bdc973f8a66055fdbf6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/.clirr-jenkins-ignore.xml @@ -0,0 +1,14 @@ + + + + ** + 5000 + ** + + + + ** + 7012 + * + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/README.md b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/README.md new file mode 100644 index 0000000000000000000000000000000000000000..00b4364e8691cc0519b277e76319c0b1bce202d1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/README.md @@ -0,0 +1,4 @@ +camunda-xml-model +================== + +XML model API written in Java. diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..f7fe9edea391374c5a5f02782946704fb749e80b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/pom.xml @@ -0,0 +1,118 @@ + + 4.0.0 + + + org.camunda.bpm.model + camunda-model-apis + ../ + 7.24.0-SNAPSHOT + + + camunda-xml-model + jar + + + Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/ + + + Camunda Platform - Xml Model API + 2014 + + org.camunda.bpm.model.xml + + org.assertj.*;resolution:=optional, + org.junit.*;resolution:=optional + + + + + + junit + junit + provided + + + + org.assertj + assertj-core + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + + + generate-sources + + cleanVersions + + + + bundle-manifest + process-classes + + manifest + + + + + + + + + + + check-api-compatibility + + true + + + + + org.codehaus.mojo + clirr-maven-plugin + + ${camunda.version.old} + true + + org/camunda/bpm/model/xml/impl/** + + + + + all + verify + + check-no-fork + + + ${project.build.directory}/clirr-all.txt + false + false + + + + restrictive + verify + + check-no-fork + + + ${project.build.directory}/clirr-restrictive.txt + true + .clirr-jenkins-ignore.xml + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/Model.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/Model.java new file mode 100644 index 0000000000000000000000000000000000000000..3927174fecb0983f7a2a27790f125f29678a13aa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/Model.java @@ -0,0 +1,90 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; + +import java.util.Collection; +import java.util.Set; + +/** + * A model contains all defined types and the relationship between them. + * See {@link ModelBuilder#createInstance} to create a new model. + * + * @author Daniel Meyer + * + */ +public interface Model { + + /** + * Gets the collection of all {@link ModelElementType} defined in the model. + * + * @return the list of all defined element types of this model + */ + Collection getTypes(); + + /** + * Gets the defined {@link ModelElementType} of a {@link ModelElementInstance}. + * + * @param instanceClass the instance class to find the type for + * @return the corresponding element type or null if no type is defined for the instance + */ + ModelElementType getType(Class instanceClass); + + /** + * Gets the defined {@link ModelElementType} for a type by its name. + * + * @param typeName the name of the type + * @return the element type or null if no type is defined for the name + */ + ModelElementType getTypeForName(String typeName); + + /** + * Gets the defined {@link ModelElementType} for a type by its name and namespace URI. + * + * + * @param namespaceUri the namespace URI for the type + * @param typeName the name of the type + * @return the element type or null if no type is defined for the name and namespace URI + */ + ModelElementType getTypeForName(String namespaceUri, String typeName); + + /** + * Returns the model name, which is the identifier of this model. + * + * @return the model name + */ + String getModelName(); + + /** + * Returns the actual namespace URI for an alternative namespace URI + * @param alternativeNs the alternative namespace URI + * @return the actual namespace URI or null if none is set + */ + String getActualNamespace(String alternativeNs); + + /** + * Returns the alternative namespace URI for a namespace URI + * @param actualNs the actual namespace URI + * @return the alternative namespace URI or null if none is set + */ + String getAlternativeNamespace(String actualNs); + + Set getAlternativeNamespaces(String actualNs); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..54a4ef5a776d5ddaa861d20bbe0c0da70e4c13cb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelBuilder.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml; + +import org.camunda.bpm.model.xml.impl.ModelBuilderImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; + +/** + * This builder is used to define and create a new model. + * + * @author Daniel Meyer + * + */ +public abstract class ModelBuilder { + + public abstract ModelBuilder alternativeNamespace(String alternativeNs, String actualNs); + + public abstract ModelElementTypeBuilder defineType(Class modelInstanceType, String typeName); + + public abstract ModelElementType defineGenericType(String typeName, String typeNamespaceUri); + + public abstract Model build(); + + public static ModelBuilder createInstance(String modelName) { + return new ModelBuilderImpl(modelName); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelException.java new file mode 100644 index 0000000000000000000000000000000000000000..45ff3b37b844d930a37eac4a08da847965ee3251 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelException.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml; + +/** + * An Exception in the Core XML Model. + * + * @author Daniel Meyer + * + */ +public class ModelException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public ModelException() { + } + + public ModelException(String message, Throwable cause) { + super(message, cause); + } + + public ModelException(String message) { + super(message); + } + + public ModelException(Throwable cause) { + super(cause); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelInstance.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelInstance.java new file mode 100644 index 0000000000000000000000000000000000000000..3a55f5d6b81e8466d0a473db3f4ebbe1d9e26031 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelInstance.java @@ -0,0 +1,147 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml; + +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.validation.ModelElementValidator; +import org.camunda.bpm.model.xml.validation.ValidationResults; + +import java.util.Collection; + +/** + * An instance of a model + * + * @author Daniel Meyer + * + */ +public interface ModelInstance { + + /** + * Returns the wrapped {@link DomDocument}. + * + * @return the DOM document + */ + DomDocument getDocument(); + + /** + * Returns the {@link ModelElementInstanceImpl ModelElement} corresponding to the document + * element of this model or null if no document element exists. + * + * @return the document element or null + */ + ModelElementInstance getDocumentElement(); + + /** + * Updates the document element. + * + * @param documentElement the new document element to set + */ + void setDocumentElement(ModelElementInstance documentElement); + + /** + * Creates a new instance of type class. + * + * @param type the class of the type to create + * @param instance type + * @return the new created instance + */ + T newInstance(Class type); + + /** + * Creates a new instance of type class with user-defined id. + * + * @param type the class of the type to create + * @param id identifier of new element instance + * @param instance type + * @return the new created instance + */ + T newInstance(Class type, String id); + + /** + * Creates a new instance of type. + * + * @param type the type to create + * @param instance type + * @return the new created instance + */ + T newInstance(ModelElementType type); + + /** + * Creates a new instance of type with user-defined id. + * + * @param type the type to create + * @param id identifier of new element instance + * @param instance type + * @return the new created instance + */ + T newInstance(ModelElementType type, String id); + + /** + * Returns the underlying model. + * + * @return the model + */ + Model getModel(); + + /** + * Find a unique element of the model by id. + * + * @param id the id of the element + * @return the element with the id or null + */ + T getModelElementById(String id); + + /** + * Find all elements of a type. + * + * @param referencingType the type of the elements + * @return the collection of elements of the type + */ + Collection getModelElementsByType(ModelElementType referencingType); + + /** + * Find all elements of a type. + * + * @param referencingClass the type class of the elements + * @return the collection of elements of the type + */ + Collection getModelElementsByType(Class referencingClass); + + /** + * Copies the model instance but not the model. So only the wrapped DOM document is cloned. + * Changes of the model are persistent between multiple model instances. + * + * @return the new model instance + */ + ModelInstance clone(); + + /** + * Validate semantic properties of this model instance using a collection of validators. + * ModelElementValidator is an SPI that can be implemented by the user to execute custom + * validation logic on the model. The validation results are collected into a {@link ValidationResults} + * object which is returned by this method. + * + * @param validators the validators to execute + * @return the results of the validation. + * @since 7.6 + */ + ValidationResults validate(Collection> validators); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelParseException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelParseException.java new file mode 100644 index 0000000000000000000000000000000000000000..8bfed0adf70596f2c59398bce9977c9cddaf584c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelParseException.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml; + + +/** + * Thrown when an error is encountered during XML parsing + * + * @author Daniel Meyer + * + */ +public class ModelParseException extends ModelException { + + private static final long serialVersionUID = 1L; + + public ModelParseException() { + } + + public ModelParseException(String message, Throwable cause) { + super(message, cause); + } + + public ModelParseException(String message) { + super(message); + } + + public ModelParseException(Throwable cause) { + super(cause); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelReferenceException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelReferenceException.java new file mode 100644 index 0000000000000000000000000000000000000000..25901e12704c682385cb9b474ebf7cc4d43d4313 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelReferenceException.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml; + + +/** + * Thrown when an error is encountered during reference resolving. + * + * @author Sebastian Menski + * + */ +public class ModelReferenceException extends ModelException { + + private static final long serialVersionUID = 1L; + + public ModelReferenceException() { + } + + public ModelReferenceException(String message, Throwable cause) { + super(message, cause); + } + + public ModelReferenceException(String message) { + super(message); + } + + public ModelReferenceException(Throwable cause) { + super(cause); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelValidationException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelValidationException.java new file mode 100644 index 0000000000000000000000000000000000000000..28905822e103e5a0c1317360e5f45032869d58d0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/ModelValidationException.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml; + + +/** + * Thrown when an error is encountered during the model validation. + * + * @author Sebastian Menski + * + */ +public class ModelValidationException extends ModelException { + + private static final long serialVersionUID = 1L; + + public ModelValidationException() { + } + + public ModelValidationException(String message, Throwable cause) { + super(message, cause); + } + + public ModelValidationException(String message) { + super(message); + } + + public ModelValidationException(Throwable cause) { + super(cause); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/UnsupportedModelOperationException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/UnsupportedModelOperationException.java new file mode 100644 index 0000000000000000000000000000000000000000..8ea65f09c0c37f75fb83bf73e3317f14252df55c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/UnsupportedModelOperationException.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml; + +import java.util.Collection; + +/** + * Exception thrown if a user attempts to perform an unsupported + * model operation. Example: call {@link Collection#add(Object)} on an + * immutable collection. + * + * @author Daniel Meyer + * + */ +public class UnsupportedModelOperationException extends UnsupportedOperationException { + + private static final long serialVersionUID = 1L; + + public UnsupportedModelOperationException(String operationName, String reason) { + super("The operation " + operationName + " is unsupported: " + reason + "."); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/ModelBuildOperation.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/ModelBuildOperation.java new file mode 100644 index 0000000000000000000000000000000000000000..7fd31e2ad8d3c26fb1c0936be0a9cedeac624771 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/ModelBuildOperation.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl; + +import org.camunda.bpm.model.xml.Model; + +/** + * A model build operation allows to participate in a model + * build phase and perform some resolution steps once all + * types are defined. + * + * @author Daniel Meyer + * + */ +public interface ModelBuildOperation { + + void performModelBuild(Model model); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/ModelBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/ModelBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..ef1f51f6140336834015f0d83e3eb4d7c0bbe62a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/ModelBuilderImpl.java @@ -0,0 +1,81 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeBuilderImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; + +import java.util.ArrayList; +import java.util.List; + +import static org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +/** + * This builder is used to define and create a new model. + * + * @author Daniel Meyer + * + */ +public class ModelBuilderImpl extends ModelBuilder { + + private final List typeBuilders = new ArrayList(); + private final ModelImpl model; + + public ModelBuilderImpl(String modelName) { + model = new ModelImpl(modelName); + } + + public ModelBuilder alternativeNamespace(String alternativeNs, String actualNs) { + model.declareAlternativeNamespace(alternativeNs, actualNs); + return this; + } + + public ModelElementTypeBuilder defineType(Class modelInstanceType, String typeName) { + ModelElementTypeBuilderImpl typeBuilder = new ModelElementTypeBuilderImpl(modelInstanceType, typeName, model); + typeBuilders.add(typeBuilder); + return typeBuilder; + } + + public ModelElementType defineGenericType(String typeName, String typeNamespaceUri) { + ModelElementTypeBuilder typeBuilder = defineType(ModelElementInstance.class, typeName) + .namespaceUri(typeNamespaceUri) + .instanceProvider(new ModelTypeInstanceProvider() { + public ModelElementInstance newInstance(ModelTypeInstanceContext instanceContext) { + return new ModelElementInstanceImpl(instanceContext); + } + }); + + return typeBuilder.build(); + } + + public Model build() { + for (ModelElementTypeBuilderImpl typeBuilder : typeBuilders) { + typeBuilder.buildTypeHierarchy(model); + } + for (ModelElementTypeBuilderImpl typeBuilder : typeBuilders) { + typeBuilder.performModelBuild(model); + } + return model; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/ModelImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/ModelImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0a4681c2c37f2e7b590be8490fe7229974dc7b8c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/ModelImpl.java @@ -0,0 +1,170 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.impl.util.ModelUtil; +import org.camunda.bpm.model.xml.impl.util.QName; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; + +/** + * A model contains all defined types and the relationship between them. + * + * @author Daniel Meyer + * + */ +public class ModelImpl implements Model { + + private final Map typesByName = new HashMap(); + private final Map, ModelElementType> typesByClass = new HashMap, ModelElementType>(); + private final String modelName; + + protected final Map> actualNsToAlternative = new HashMap>(); + protected final Map alternativeNsToActual = new HashMap(); + + /** + * Create a new {@link Model} with a model name. + * @param modelName the model name to identify the model + */ + public ModelImpl(String modelName) { + this.modelName = modelName; + } + + /** + * Declares an alternative namespace for an actual so that during lookup of elements/attributes both will be considered. + * This can be used if a newer namespaces replaces an older one but XML files with the old one should still be parseable. + * @param alternativeNs + * @param actualNs + * @throws IllegalArgumentException if the alternative is already used or if the actual namespace has an alternative + */ + public void declareAlternativeNamespace(String alternativeNs, String actualNs) { + Set alternativeNamespaces = actualNsToAlternative.get(actualNs); + if (alternativeNamespaces == null) + { + // linked hash set for consistent iteration order + alternativeNamespaces = new LinkedHashSet(); + actualNsToAlternative.put(actualNs, alternativeNamespaces); + } + + alternativeNamespaces.add(alternativeNs); + alternativeNsToActual.put(alternativeNs, actualNs); + } + + public void undeclareAlternativeNamespace(String alternativeNs){ + if(!alternativeNsToActual.containsKey(alternativeNs)){ + return; + } + String actual = alternativeNsToActual.remove(alternativeNs); + actualNsToAlternative.remove(actual); + } + + public Set getAlternativeNamespaces(String actualNs) { + return actualNsToAlternative.get(actualNs); + } + + @Override + public String getAlternativeNamespace(String actualNs) { + Set alternatives = getAlternativeNamespaces(actualNs); + + if (alternatives == null || alternatives.size() == 0) { + return null; + } + else if (alternatives.size() == 1) { + return alternatives.iterator().next(); + } + else + { + throw new ModelException("There is more than one alternative namespace registered"); + } + } + + public String getActualNamespace(String alternativeNs) { + return alternativeNsToActual.get(alternativeNs); + } + + public Collection getTypes() { + return new ArrayList(typesByName.values()); + } + + public ModelElementType getType(Class instanceClass) { + return typesByClass.get(instanceClass); + } + + public ModelElementType getTypeForName(String typeName) { + return getTypeForName(null, typeName); + } + + public ModelElementType getTypeForName(String namespaceUri, String typeName) { + return typesByName.get(ModelUtil.getQName(namespaceUri, typeName)); + } + + /** + * Registers a {@link ModelElementType} in this {@link Model}. + * + * @param modelElementType the element type to register + * @param instanceType the instance class of the type to register + */ + public void registerType(ModelElementType modelElementType, Class instanceType) { + QName qName = ModelUtil.getQName(modelElementType.getTypeNamespace(), modelElementType.getTypeName()); + typesByName.put(qName, modelElementType); + typesByClass.put(instanceType, modelElementType); + } + + public String getModelName() { + return modelName; + } + + @Override + public int hashCode() { + int prime = 31; + int result = 1; + result = prime * result + ((modelName == null) ? 0 : modelName.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ModelImpl other = (ModelImpl) obj; + if (modelName == null) { + if (other.modelName != null) { + return false; + } + } else if (!modelName.equals(other.modelName)) { + return false; + } + return true; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/ModelInstanceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/ModelInstanceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..10d32d15aac9aec51b73b7658b35d4095400460b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/ModelInstanceImpl.java @@ -0,0 +1,157 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.util.ModelUtil; +import org.camunda.bpm.model.xml.impl.validation.ModelInstanceValidator; +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.camunda.bpm.model.xml.instance.DomElement; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.validation.ModelElementValidator; +import org.camunda.bpm.model.xml.validation.ValidationResults; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * An instance of a model + * + * @author Daniel Meyer + * @author Sebastian Menski + * + */ +public class ModelInstanceImpl implements ModelInstance { + + protected final DomDocument document; + protected ModelImpl model; + protected final ModelBuilder modelBuilder; + + public ModelInstanceImpl(ModelImpl model, ModelBuilder modelBuilder, DomDocument document) { + this.model = model; + this.modelBuilder = modelBuilder; + this.document = document; + } + + public DomDocument getDocument() { + return document; + } + + public ModelElementInstance getDocumentElement() { + DomElement rootElement = document.getRootElement(); + if(rootElement != null) { + return ModelUtil.getModelElement(rootElement, this); + } else { + return null; + } + } + + public void setDocumentElement(ModelElementInstance modelElement) { + ModelUtil.ensureInstanceOf(modelElement, ModelElementInstanceImpl.class); + DomElement domElement = modelElement.getDomElement(); + document.setRootElement(domElement); + } + + public T newInstance(Class type) { + return newInstance(type, null); + } + + public T newInstance(Class type, String id) { + ModelElementType modelElementType = model.getType(type); + if(modelElementType != null) { + return newInstance(modelElementType, id); + } else { + throw new ModelException("Cannot create instance of ModelType "+type+": no such type registered."); + } + } + + public T newInstance(ModelElementType type) { + return newInstance(type, null); + } + + @SuppressWarnings("unchecked") + public T newInstance(ModelElementType type, String id) { + ModelElementInstance modelElementInstance = type.newInstance(this); + if (id != null && !id.isEmpty()) { + ModelUtil.setNewIdentifier(type, modelElementInstance, id, false); + } else { + ModelUtil.setGeneratedUniqueIdentifier(type, modelElementInstance, false); + } + return (T) modelElementInstance; + } + + public Model getModel() { + return model; + } + + public ModelElementType registerGenericType(String namespaceUri, String localName) { + ModelElementType elementType = model.getTypeForName(namespaceUri, localName); + if (elementType == null) { + elementType = modelBuilder.defineGenericType(localName, namespaceUri); + model = (ModelImpl) modelBuilder.build(); + } + return elementType; + } + + @SuppressWarnings("unchecked") + public T getModelElementById(String id) { + if (id == null) { + return null; + } + + DomElement element = document.getElementById(id); + if(element != null) { + return (T) ModelUtil.getModelElement(element, this); + } else { + return null; + } + } + + public Collection getModelElementsByType(ModelElementType type) { + Collection extendingTypes = type.getAllExtendingTypes(); + + List instances = new ArrayList(); + for (ModelElementType modelElementType : extendingTypes) { + if(!modelElementType.isAbstract()) { + instances.addAll(modelElementType.getInstances(this)); + } + } + return instances; + } + + @SuppressWarnings("unchecked") + public Collection getModelElementsByType(Class referencingClass) { + return (Collection) getModelElementsByType(getModel().getType(referencingClass)); + } + + @Override + public ModelInstance clone() { + return new ModelInstanceImpl(model, modelBuilder, document.clone()); + } + + @Override + public ValidationResults validate(Collection> validators) { + return new ModelInstanceValidator(this, validators).validate(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/instance/DomDocumentImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/instance/DomDocumentImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0a899c53a56fbd3dded9f802331cfc53da925a5a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/instance/DomDocumentImpl.java @@ -0,0 +1,165 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.instance; + +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.impl.util.DomUtil; +import org.camunda.bpm.model.xml.impl.util.XmlQName; +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.camunda.bpm.model.xml.instance.DomElement; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import javax.xml.transform.dom.DOMSource; +import java.util.List; + +import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI; + +/** + * @author Sebastian Menski + */ +public class DomDocumentImpl implements DomDocument { + + public static final String GENERIC_NS_PREFIX = "ns"; + + private final Document document; + + public DomDocumentImpl(Document document) { + this.document = document; + } + + public DomElement getRootElement() { + synchronized(document) { + Element documentElement = document.getDocumentElement(); + if (documentElement != null) { + return new DomElementImpl(documentElement); + } + else { + return null; + } + } + + } + + public void setRootElement(DomElement rootElement) { + synchronized(document) { + Element documentElement = document.getDocumentElement(); + Element newDocumentElement = ((DomElementImpl) rootElement).getElement(); + if (documentElement != null) { + document.replaceChild(newDocumentElement, documentElement); + } + else { + document.appendChild(newDocumentElement); + } + } + } + + public DomElement createElement(String namespaceUri, String localName) { + synchronized(document) { + XmlQName xmlQName = new XmlQName(this, namespaceUri, localName); + Element element = document.createElementNS(xmlQName.getNamespaceUri(), xmlQName.getPrefixedName()); + return new DomElementImpl(element); + } + } + + public DomElement getElementById(String id) { + synchronized(document) { + Element element = document.getElementById(id); + if (element != null) { + return new DomElementImpl(element); + } + else { + return null; + } + } + } + + public List getElementsByNameNs(String namespaceUri, String localName) { + synchronized(document) { + NodeList elementsByTagNameNS = document.getElementsByTagNameNS(namespaceUri, localName); + return DomUtil.filterNodeListByName(elementsByTagNameNS, namespaceUri, localName); + } + } + + public DOMSource getDomSource() { + return new DOMSource(document); + } + + public String registerNamespace(String namespaceUri) { + synchronized(document) { + DomElement rootElement = getRootElement(); + if (rootElement != null) { + return rootElement.registerNamespace(namespaceUri); + } + else { + throw new ModelException("Unable to define a new namespace without a root document element"); + } + } + } + + public void registerNamespace(String prefix, String namespaceUri) { + synchronized(document) { + DomElement rootElement = getRootElement(); + if (rootElement != null) { + rootElement.registerNamespace(prefix, namespaceUri); + } + else { + throw new ModelException("Unable to define a new namespace without a root document element"); + } + } + } + + protected String getUnusedGenericNsPrefix() { + synchronized(document) { + Element documentElement = document.getDocumentElement(); + if (documentElement == null) { + return GENERIC_NS_PREFIX + "0"; + } + else { + for (int i = 0; i < Integer.MAX_VALUE; i++) { + if (!documentElement.hasAttributeNS(XMLNS_ATTRIBUTE_NS_URI, GENERIC_NS_PREFIX + i)) { + return GENERIC_NS_PREFIX + i; + } + } + throw new ModelException("Unable to find an unused namespace prefix"); + } + } + } + + public DomDocument clone() { + synchronized(document) { + return new DomDocumentImpl((Document) document.cloneNode(true)); + } + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + DomDocumentImpl that = (DomDocumentImpl) o; + return document.equals(that.document); + } + + public int hashCode() { + return document.hashCode(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/instance/DomElementImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/instance/DomElementImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..bea1cdec877f5bcfb901083c0ad4fe82e15d7c4f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/instance/DomElementImpl.java @@ -0,0 +1,362 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.instance; + +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.impl.util.DomUtil; +import org.camunda.bpm.model.xml.impl.util.XmlQName; +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.camunda.bpm.model.xml.instance.DomElement; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.w3c.dom.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE; +import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI; + +/** + * @author Sebastian Menski + */ +public class DomElementImpl implements DomElement { + + private static final String MODEL_ELEMENT_KEY = "camunda.modelElementRef"; + + private final Element element; + private final Document document; + + public DomElementImpl(Element element) { + this.element = element; + this.document = element.getOwnerDocument(); + } + + protected Element getElement() { + return element; + } + + public String getNamespaceURI() { + synchronized(document) { + return element.getNamespaceURI(); + } + } + + public String getLocalName() { + synchronized(document) { + return element.getLocalName(); + } + } + + public String getPrefix() { + synchronized(document) { + return element.getPrefix(); + } + } + + public DomDocument getDocument() { + synchronized(document) { + Document ownerDocument = element.getOwnerDocument(); + if (ownerDocument != null) { + return new DomDocumentImpl(ownerDocument); + } + else { + return null; + } + } + } + + public DomElement getRootElement() { + synchronized(document) { + DomDocument document = getDocument(); + if (document != null) { + return document.getRootElement(); + } + else { + return null; + } + } + } + + public DomElement getParentElement() { + synchronized(document) { + Node parentNode = element.getParentNode(); + if (parentNode != null && parentNode instanceof Element) { + return new DomElementImpl((Element) parentNode); + } + else { + return null; + } + } + } + + public List getChildElements() { + synchronized(document) { + NodeList childNodes = element.getChildNodes(); + return DomUtil.filterNodeListForElements(childNodes); + } + } + + public List getChildElementsByNameNs(String namespaceUri, String elementName) { + synchronized(document) { + NodeList childNodes = element.getChildNodes(); + return DomUtil.filterNodeListByName(childNodes, namespaceUri, elementName); + } + } + + @Override + public List getChildElementsByNameNs(Set namespaceUris, String elementName) { + List result = new ArrayList(); + for (String namespace : namespaceUris) { + if (namespace != null) { + result.addAll(getChildElementsByNameNs(namespace, elementName)); + } + } + return result; + } + + public List getChildElementsByType(ModelInstanceImpl modelInstance, Class elementType) { + synchronized(document) { + NodeList childNodes = element.getChildNodes(); + return DomUtil.filterNodeListByType(childNodes, modelInstance, elementType); + } + } + + public void replaceChild(DomElement newChildDomElement, DomElement existingChildDomElement) { + synchronized(document) { + Element newElement = ((DomElementImpl) newChildDomElement).getElement(); + Element existingElement = ((DomElementImpl) existingChildDomElement).getElement(); + try { + element.replaceChild(newElement, existingElement); + } + catch (DOMException e) { + throw new ModelException("Unable to replace child <" + existingElement + "> of element <" + element + "> with element <" + newElement + ">", e); + } + } + } + + public boolean removeChild(DomElement childDomElement) { + synchronized(document) { + Element childElement = ((DomElementImpl) childDomElement).getElement(); + try { + element.removeChild(childElement); + return true; + } + catch (DOMException e) { + return false; + } + } + } + + public void appendChild(DomElement childDomElement) { + synchronized(document) { + Element childElement = ((DomElementImpl) childDomElement).getElement(); + element.appendChild(childElement); + } + } + + public void insertChildElementAfter(DomElement elementToInsert, DomElement insertAfter) { + synchronized(document) { + Element newElement = ((DomElementImpl) elementToInsert).getElement(); + // find node to insert before + Node insertBeforeNode; + if (insertAfter == null) { + insertBeforeNode = element.getFirstChild(); + } + else { + insertBeforeNode = ((DomElementImpl) insertAfter).getElement().getNextSibling(); + } + + // insert before node or append if no node was found + if (insertBeforeNode != null) { + element.insertBefore(newElement, insertBeforeNode); + } + else { + element.appendChild(newElement); + } + } + } + + public boolean hasAttribute(String localName) { + return hasAttribute(null, localName); + } + + public boolean hasAttribute(String namespaceUri, String localName) { + synchronized(document) { + return element.hasAttributeNS(namespaceUri, localName); + } + } + + public String getAttribute(String attributeName) { + return getAttribute(null, attributeName); + } + + + public String getAttribute(String namespaceUri, String localName) { + synchronized(document) { + XmlQName xmlQName = new XmlQName(this, namespaceUri, localName); + String value; + if (xmlQName.hasLocalNamespace()) { + value = element.getAttributeNS(null, xmlQName.getLocalName()); + } + else { + value = element.getAttributeNS(xmlQName.getNamespaceUri(), xmlQName.getLocalName()); + } + if (value.isEmpty()) { + return null; + } + else { + return value; + } + } + } + + public void setAttribute(String localName, String value) { + setAttribute(null, localName, value); + } + + public void setAttribute(String namespaceUri, String localName, String value) { + setAttribute(namespaceUri, localName, value, false); + } + + private void setAttribute(String namespaceUri, String localName, String value, boolean isIdAttribute) { + synchronized(document) { + XmlQName xmlQName = new XmlQName(this, namespaceUri, localName); + if (xmlQName.hasLocalNamespace()) { + element.setAttributeNS(null, xmlQName.getLocalName(), value); + if (isIdAttribute) { + element.setIdAttributeNS(null, xmlQName.getLocalName(), true); + } + } + else { + element.setAttributeNS(xmlQName.getNamespaceUri(), xmlQName.getPrefixedName(), value); + if (isIdAttribute) { + element.setIdAttributeNS(xmlQName.getNamespaceUri(), xmlQName.getLocalName(), true); + } + } + } + } + + public void setIdAttribute(String localName, String value) { + setIdAttribute(getNamespaceURI(), localName, value); + } + + public void setIdAttribute(String namespaceUri, String localName, String value) { + setAttribute(namespaceUri, localName, value, true); + } + + public void removeAttribute(String localName) { + removeAttribute(getNamespaceURI(), localName); + } + + public void removeAttribute(String namespaceUri, String localName) { + synchronized(document) { + XmlQName xmlQName = new XmlQName(this, namespaceUri, localName); + if (xmlQName.hasLocalNamespace()) { + element.removeAttributeNS(null, xmlQName.getLocalName()); + } + else { + element.removeAttributeNS(xmlQName.getNamespaceUri(), xmlQName.getLocalName()); + } + } + } + + public String getTextContent() { + synchronized(document) { + return element.getTextContent(); + } + } + + public void setTextContent(String textContent) { + synchronized(document) { + element.setTextContent(textContent); + } + } + + public void addCDataSection(String data) { + synchronized (document) { + CDATASection cdataSection = document.createCDATASection(data); + element.appendChild(cdataSection); + } + } + + public ModelElementInstance getModelElementInstance() { + synchronized(document) { + return (ModelElementInstance) element.getUserData(MODEL_ELEMENT_KEY); + } + } + + public void setModelElementInstance(ModelElementInstance modelElementInstance) { + synchronized(document) { + element.setUserData(MODEL_ELEMENT_KEY, modelElementInstance, null); + } + } + + public String registerNamespace(String namespaceUri) { + synchronized(document) { + String lookupPrefix = lookupPrefix(namespaceUri); + if (lookupPrefix == null) { + // check if a prefix is known + String prefix = XmlQName.KNOWN_PREFIXES.get(namespaceUri); + // check if prefix is not already used + if (prefix != null && getRootElement() != null && + getRootElement().hasAttribute(XMLNS_ATTRIBUTE_NS_URI, prefix)) { + prefix = null; + } + if (prefix == null) { + // generate prefix + prefix = ((DomDocumentImpl) getDocument()).getUnusedGenericNsPrefix(); + } + registerNamespace(prefix, namespaceUri); + return prefix; + } + else { + return lookupPrefix; + } + } + } + + public void registerNamespace(String prefix, String namespaceUri) { + synchronized(document) { + element.setAttributeNS(XMLNS_ATTRIBUTE_NS_URI, XMLNS_ATTRIBUTE + ":" + prefix, namespaceUri); + } + } + + public String lookupPrefix(String namespaceUri) { + synchronized(document) { + return element.lookupPrefix(namespaceUri); + } + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + DomElementImpl that = (DomElementImpl) o; + return element.equals(that.element); + } + + public int hashCode() { + return element.hashCode(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/instance/ModelElementInstanceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/instance/ModelElementInstanceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..6f38c9233007bb9497de7a22fc18cb1d27aca8a6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/instance/ModelElementInstanceImpl.java @@ -0,0 +1,410 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.instance; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl; +import org.camunda.bpm.model.xml.impl.type.reference.ReferenceImpl; +import org.camunda.bpm.model.xml.impl.util.ModelUtil; +import org.camunda.bpm.model.xml.instance.DomElement; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.reference.Reference; + +/** + * Base class for implementing Model Elements. + * + * @author Daniel Meyer + * + */ +public class ModelElementInstanceImpl implements ModelElementInstance { + + /** the containing model instance */ + protected final ModelInstanceImpl modelInstance; + /** the wrapped DOM {@link DomElement} */ + private final DomElement domElement; + /** the implementing model element type */ + private final ModelElementTypeImpl elementType; + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ModelElementInstance.class, "") + .abstractType(); + + typeBuilder.build(); + } + + public ModelElementInstanceImpl(ModelTypeInstanceContext instanceContext) { + this.domElement = instanceContext.getDomElement(); + this.modelInstance = instanceContext.getModel(); + this.elementType = instanceContext.getModelType(); + } + + public DomElement getDomElement() { + return domElement; + } + + public ModelInstanceImpl getModelInstance() { + return modelInstance; + } + + public ModelElementInstance getParentElement() { + DomElement parentElement = domElement.getParentElement(); + if (parentElement != null) { + return ModelUtil.getModelElement(parentElement, modelInstance); + } + else { + return null; + } + } + + public ModelElementType getElementType() { + return elementType; + } + + public String getAttributeValue(String attributeName) { + return domElement.getAttribute(attributeName); + } + + public String getAttributeValueNs(String namespaceUri, String attributeName) { + return domElement.getAttribute(namespaceUri, attributeName); + } + + public void setAttributeValue(String attributeName, String xmlValue) { + setAttributeValue(attributeName, xmlValue, false, true); + } + + public void setAttributeValue(String attributeName, String xmlValue, boolean isIdAttribute) { + setAttributeValue(attributeName, xmlValue, isIdAttribute, true); + } + + public void setAttributeValue(String attributeName, String xmlValue, + boolean isIdAttribute, boolean withReferenceUpdate) { + String oldValue = getAttributeValue(attributeName); + if (isIdAttribute) { + domElement.setIdAttribute(attributeName, xmlValue); + } + else { + domElement.setAttribute(attributeName, xmlValue); + } + Attribute attribute = elementType.getAttribute(attributeName); + if (attribute != null && withReferenceUpdate) { + ((AttributeImpl) attribute).updateIncomingReferences(this, xmlValue, oldValue); + } + } + + public void setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue) { + setAttributeValueNs(namespaceUri, attributeName, xmlValue, false, true); + } + + public void setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue, boolean isIdAttribute) { + setAttributeValueNs(namespaceUri, attributeName, xmlValue, isIdAttribute, true); + } + + public void setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue, + boolean isIdAttribute, boolean withReferenceUpdate) { + String namespaceForSetting = determineNamespace(namespaceUri, attributeName); + String oldValue = getAttributeValueNs(namespaceForSetting, attributeName); + if (isIdAttribute) { + domElement.setIdAttribute(namespaceForSetting, attributeName, xmlValue); + } + else { + domElement.setAttribute(namespaceForSetting, attributeName, xmlValue); + } + Attribute attribute = elementType.getAttribute(attributeName); + if (attribute != null && withReferenceUpdate) { + ((AttributeImpl) attribute).updateIncomingReferences(this, xmlValue, oldValue); + } + } + + private String determineNamespace(String intendedNamespace, String attributeName) { + boolean isSetInIntendedNamespace = getAttributeValueNs(intendedNamespace, attributeName) != null; + + if (isSetInIntendedNamespace) { + return intendedNamespace; + } + else { + Set alternativeNamespaces = modelInstance.getModel().getAlternativeNamespaces(intendedNamespace); + + if (alternativeNamespaces != null) + { + for (String alternativeNamespace : alternativeNamespaces) { + if (getAttributeValueNs(alternativeNamespace, attributeName) != null) { + return alternativeNamespace; + } + } + } + + // default to intended namespace + return intendedNamespace; + } + } + + public void removeAttribute(String attributeName) { + Attribute attribute = elementType.getAttribute(attributeName); + if (attribute != null) { + Object identifier = attribute.getValue(this); + if (identifier != null) { + ((AttributeImpl) attribute).unlinkReference(this, identifier); + } + } + domElement.removeAttribute(attributeName); + } + + public void removeAttributeNs(String namespaceUri, String attributeName) { + Attribute attribute = elementType.getAttribute(attributeName); + if (attribute != null) { + Object identifier = attribute.getValue(this); + if (identifier != null) { + ((AttributeImpl) attribute).unlinkReference(this, identifier); + } + } + domElement.removeAttribute(namespaceUri, attributeName); + } + + public String getTextContent() { + return getRawTextContent().trim(); + } + + public void setTextContent(String textContent) { + domElement.setTextContent(textContent); + } + + public String getRawTextContent() { + return domElement.getTextContent(); + } + + public ModelElementInstance getUniqueChildElementByNameNs(String namespaceUri, String elementName) { + Model model = modelInstance.getModel(); + List childElements = domElement.getChildElementsByNameNs(asSet(namespaceUri, model.getAlternativeNamespaces(namespaceUri)), elementName); + if(!childElements.isEmpty()) { + return ModelUtil.getModelElement(childElements.get(0), modelInstance); + } else { + return null; + } + } + + + public ModelElementInstance getUniqueChildElementByType(Class elementType) { + List childElements = domElement.getChildElementsByType(modelInstance, elementType); + + if(!childElements.isEmpty()) { + return ModelUtil.getModelElement(childElements.get(0), modelInstance); + } + else { + return null; + } + } + + public void setUniqueChildElementByNameNs(ModelElementInstance newChild) { + ModelUtil.ensureInstanceOf(newChild, ModelElementInstanceImpl.class); + ModelElementInstanceImpl newChildElement = (ModelElementInstanceImpl) newChild; + + DomElement childElement = newChildElement.getDomElement(); + ModelElementInstance existingChild = getUniqueChildElementByNameNs(childElement.getNamespaceURI(), childElement.getLocalName()); + if(existingChild == null) { + addChildElement(newChild); + } else { + replaceChildElement(existingChild, newChildElement); + } + } + + public void replaceChildElement(ModelElementInstance existingChild, ModelElementInstance newChild) { + DomElement existingChildDomElement = existingChild.getDomElement(); + DomElement newChildDomElement = newChild.getDomElement(); + + // unlink (remove all references) of child elements + ((ModelElementInstanceImpl) existingChild).unlinkAllChildReferences(); + + // update incoming references from old to new child element + updateIncomingReferences(existingChild, newChild); + + // replace the existing child with the new child in the DOM + domElement.replaceChild(newChildDomElement, existingChildDomElement); + + // execute after replacement updates + newChild.updateAfterReplacement(); + } + + @SuppressWarnings("unchecked") + private void updateIncomingReferences(ModelElementInstance oldInstance, ModelElementInstance newInstance) { + String oldId = oldInstance.getAttributeValue("id"); + String newId = newInstance.getAttributeValue("id"); + + if (oldId == null || newId == null) { + return; + } + + Collection> attributes = ((ModelElementTypeImpl) oldInstance.getElementType()).getAllAttributes(); + for (Attribute attribute : attributes) { + if (attribute.isIdAttribute()) { + for (Reference incomingReference : attribute.getIncomingReferences()) { + ((ReferenceImpl) incomingReference).referencedElementUpdated(newInstance, oldId, newId); + } + } + } + + } + + public void replaceWithElement(ModelElementInstance newElement) { + ModelElementInstanceImpl parentElement = (ModelElementInstanceImpl) getParentElement(); + if (parentElement != null) { + parentElement.replaceChildElement(this, newElement); + } + else { + throw new ModelException("Unable to remove replace without parent"); + } + } + + public void addChildElement(ModelElementInstance newChild) { + ModelUtil.ensureInstanceOf(newChild, ModelElementInstanceImpl.class); + ModelElementInstance elementToInsertAfter = findElementToInsertAfter(newChild); + insertElementAfter(newChild, elementToInsertAfter); + } + + public boolean removeChildElement(ModelElementInstance child) { + ModelElementInstanceImpl childImpl = (ModelElementInstanceImpl) child; + childImpl.unlinkAllReferences(); + childImpl.unlinkAllChildReferences(); + return domElement.removeChild(child.getDomElement()); + } + + public Collection getChildElementsByType(ModelElementType childElementType) { + List instances = new ArrayList(); + for (ModelElementType extendingType : childElementType.getExtendingTypes()) { + instances.addAll(getChildElementsByType(extendingType)); + } + Model model = modelInstance.getModel(); + Set alternativeNamespaces = model.getAlternativeNamespaces(childElementType.getTypeNamespace()); + List elements = domElement.getChildElementsByNameNs(asSet(childElementType.getTypeNamespace(), alternativeNamespaces), childElementType.getTypeName()); + instances.addAll(ModelUtil.getModelElementCollection(elements, modelInstance)); + return instances; + } + + @SuppressWarnings("unchecked") + public Collection getChildElementsByType(Class childElementClass) { + return (Collection) getChildElementsByType(getModelInstance().getModel().getType(childElementClass)); + } + + /** + * Returns the element after which the new element should be inserted in the DOM document. + * + * @param elementToInsert the new element to insert + * @return the element to insert after or null + */ + private ModelElementInstance findElementToInsertAfter(ModelElementInstance elementToInsert) { + List childElementTypes = elementType.getAllChildElementTypes(); + List childDomElements = domElement.getChildElements(); + Collection childElements = ModelUtil.getModelElementCollection(childDomElements, modelInstance); + + ModelElementInstance insertAfterElement = null; + int newElementTypeIndex = ModelUtil.getIndexOfElementType(elementToInsert, childElementTypes); + for (ModelElementInstance childElement : childElements) { + int childElementTypeIndex = ModelUtil.getIndexOfElementType(childElement, childElementTypes); + if (newElementTypeIndex >= childElementTypeIndex) { + insertAfterElement = childElement; + } + else { + break; + } + } + return insertAfterElement; + } + + public void insertElementAfter(ModelElementInstance elementToInsert, ModelElementInstance insertAfterElement) { + if (insertAfterElement == null || insertAfterElement.getDomElement() == null) { + domElement.insertChildElementAfter(elementToInsert.getDomElement(), null); + } + else { + domElement.insertChildElementAfter(elementToInsert.getDomElement(), insertAfterElement.getDomElement()); + } + } + + public void updateAfterReplacement() { + // do nothing + } + + /** + * Removes all reference to this. + */ + private void unlinkAllReferences() { + Collection> attributes = elementType.getAllAttributes(); + for (Attribute attribute : attributes) { + Object identifier = attribute.getValue(this); + if (identifier != null) { + ((AttributeImpl) attribute).unlinkReference(this, identifier); + } + } + } + + /** + * Removes every reference to children of this. + */ + private void unlinkAllChildReferences() { + List childElementTypes = elementType.getAllChildElementTypes(); + for (ModelElementType type : childElementTypes) { + Collection childElementsForType = getChildElementsByType(type); + for (ModelElementInstance childElement : childElementsForType) { + ((ModelElementInstanceImpl) childElement).unlinkAllReferences(); + } + } + } + + protected Set asSet(T element, Set elements){ + Set result = new HashSet(); + result.add(element); + + if (elements != null) { + result.addAll(elements); + } + + return result; + } + + @Override + public int hashCode() { + return domElement.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if(obj == null) { + return false; + } else if(obj == this) { + return true; + } else if(!(obj instanceof ModelElementInstanceImpl)) { + return false; + } else { + ModelElementInstanceImpl other = (ModelElementInstanceImpl) obj; + return other.domElement.equals(domElement); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/instance/ModelTypeInstanceContext.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/instance/ModelTypeInstanceContext.java new file mode 100644 index 0000000000000000000000000000000000000000..bffc6193deb3209d01c6e8a23b6cacc3e4a03d33 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/instance/ModelTypeInstanceContext.java @@ -0,0 +1,61 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.instance; + +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.instance.DomElement; + +/** + * @author Daniel Meyer + * @author Sebastian Menski + * + */ +public final class ModelTypeInstanceContext { + + private final ModelInstanceImpl model; + private final DomElement domElement; + private final ModelElementTypeImpl modelType; + + public ModelTypeInstanceContext(DomElement domElement, ModelInstanceImpl model, ModelElementTypeImpl modelType) { + this.domElement = domElement; + this.model = model; + this.modelType = modelType; + } + + /** + * @return the dom element + */ + public DomElement getDomElement() { + return domElement; + } + + /** + * @return the model + */ + public ModelInstanceImpl getModel() { + return model; + } + + /** + * @return the modelType + */ + public ModelElementTypeImpl getModelType() { + return modelType; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/parser/AbstractModelParser.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/parser/AbstractModelParser.java new file mode 100644 index 0000000000000000000000000000000000000000..7e4f05026331829d0927a4d0275676a0c3036618 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/parser/AbstractModelParser.java @@ -0,0 +1,195 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.parser; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import javax.xml.validation.Validator; +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.ModelValidationException; +import org.camunda.bpm.model.xml.impl.util.DomUtil; +import org.camunda.bpm.model.xml.impl.util.ReflectUtil; +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.camunda.bpm.model.xml.instance.DomElement; +import org.xml.sax.SAXException; + +/** + * @author Daniel Meyer + * + */ +public abstract class AbstractModelParser { + + protected static final String JAXP_ACCESS_EXTERNAL_SCHEMA = "http://javax.xml.XMLConstants/property/accessExternalSchema"; + protected static final String JAXP_ACCESS_EXTERNAL_SCHEMA_SYSTEM_PROPERTY = "javax.xml.accessExternalSchema"; + protected static final String JAXP_ACCESS_EXTERNAL_SCHEMA_ALL = "all"; + + private final DocumentBuilderFactory documentBuilderFactory; + protected SchemaFactory schemaFactory; + protected Map schemas = new HashMap<>(); + + protected AbstractModelParser() { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + configureFactory(dbf); + this.documentBuilderFactory = dbf; + } + + /** + * allows subclasses to configure the {@link DocumentBuilderFactory}. + * @param dbf the factory to configure + */ + protected void configureFactory(DocumentBuilderFactory dbf) { + dbf.setValidating(true); + dbf.setIgnoringComments(false); + dbf.setIgnoringElementContentWhitespace(false); + dbf.setNamespaceAware(true); + protectAgainstXxeAttacks(dbf); + enableSecureProcessing(dbf); + } + + /** + * Configures the DocumentBuilderFactory in a way, that it is protected against XML External Entity Attacks. + * If the implementing parser does not support one or multiple features, the failed feature is ignored. + * The parser might not protected, if the feature assignment fails. + * + * @see OWASP Information of XXE attacks + * + * @param dbf The factory to configure. + */ + private void protectAgainstXxeAttacks(final DocumentBuilderFactory dbf) { + try { + dbf.setFeature("http://xml.org/sax/features/external-general-entities", false); + } catch (ParserConfigurationException ignored) { + } + + try { + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); + } catch (ParserConfigurationException ignored) { + } + + try { + dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + } catch (ParserConfigurationException ignored) { + } + + dbf.setXIncludeAware(false); + dbf.setExpandEntityReferences(false); + } + + private void enableSecureProcessing(final DocumentBuilderFactory dbf) { + try { + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + dbf.setAttribute(JAXP_ACCESS_EXTERNAL_SCHEMA, resolveAccessExternalSchemaProperty()); + } catch (ParserConfigurationException | IllegalArgumentException ignored) { + // ignored + } + } + + /* + * JAXP allows users to override the default value via system properties and + * a central properties file (see https://docs.oracle.com/javase/tutorial/jaxp/properties/scope.html). + * However, both are overridden by an explicit configuration in code, as we apply it. + * Since we want users to customize the value, we take the system property into account. + * The properties file is not supported at the moment. + */ + protected String resolveAccessExternalSchemaProperty() { + String systemProperty = System.getProperty(JAXP_ACCESS_EXTERNAL_SCHEMA_SYSTEM_PROPERTY); + + if (systemProperty != null) { + return systemProperty; + } else { + return JAXP_ACCESS_EXTERNAL_SCHEMA_ALL; + } + } + + public ModelInstance parseModelFromStream(InputStream inputStream) { + DomDocument document = null; + + synchronized(documentBuilderFactory) { + document = DomUtil.parseInputStream(documentBuilderFactory, inputStream); + } + + validateModel(document); + return createModelInstance(document); + + } + + public ModelInstance getEmptyModel() { + DomDocument document = null; + + synchronized(documentBuilderFactory) { + document = DomUtil.getEmptyDocument(documentBuilderFactory); + } + + return createModelInstance(document); + } + + /** + * Validate DOM document + * + * @param document the DOM document to validate + */ + public void validateModel(DomDocument document) { + + Schema schema = getSchema(document); + + if (schema == null) { + return; + } + + Validator validator = schema.newValidator(); + try { + synchronized(document) { + validator.validate(document.getDomSource()); + } + } catch (IOException e) { + throw new ModelValidationException("Error during DOM document validation", e); + } catch (SAXException e) { + throw new ModelValidationException("DOM document is not valid", e); + } + } + + protected Schema getSchema(DomDocument document) { + DomElement rootElement = document.getRootElement(); + String namespaceURI = rootElement.getNamespaceURI(); + return schemas.get(namespaceURI); + } + + protected void addSchema(String namespaceURI, Schema schema) { + schemas.put(namespaceURI, schema); + } + + protected Schema createSchema(String location, ClassLoader classLoader) { + URL cmmnSchema = ReflectUtil.getResource(location, classLoader); + try { + return schemaFactory.newSchema(cmmnSchema); + } catch (SAXException e) { + throw new ModelValidationException("Unable to parse schema:" + cmmnSchema); + } + } + + protected abstract ModelInstance createModelInstance(DomDocument document); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..1bf5e6af00e0a2532cb6ae429f2a3e862e34cf03 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeBuilderImpl.java @@ -0,0 +1,141 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.impl.ModelBuildOperation; +import org.camunda.bpm.model.xml.impl.ModelImpl; +import org.camunda.bpm.model.xml.impl.type.attribute.*; +import org.camunda.bpm.model.xml.impl.type.child.SequenceBuilderImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.attribute.AttributeBuilder; +import org.camunda.bpm.model.xml.type.attribute.StringAttributeBuilder; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Daniel Meyer + * + */ +public class ModelElementTypeBuilderImpl implements ModelElementTypeBuilder, ModelBuildOperation { + + private final ModelElementTypeImpl modelType; + private final ModelImpl model; + private final Class instanceType; + + private final List modelBuildOperations = new ArrayList(); + private Class extendedType; + + public ModelElementTypeBuilderImpl(Class instanceType, String name, ModelImpl model) { + this.instanceType = instanceType; + this.model = model; + modelType = new ModelElementTypeImpl(model, name, instanceType); + } + + public ModelElementTypeBuilder extendsType(Class extendedType) { + this.extendedType = extendedType; + return this; + } + + public ModelElementTypeBuilder instanceProvider(ModelTypeInstanceProvider instanceProvider) { + modelType.setInstanceProvider(instanceProvider); + return this; + } + + public ModelElementTypeBuilder namespaceUri(String namespaceUri) { + modelType.setTypeNamespace(namespaceUri); + return this; + } + + public AttributeBuilder booleanAttribute(String attributeName) { + BooleanAttributeBuilder builder = new BooleanAttributeBuilder(attributeName, modelType); + modelBuildOperations.add(builder); + return builder; + } + + public StringAttributeBuilder stringAttribute(String attributeName) { + StringAttributeBuilderImpl builder = new StringAttributeBuilderImpl(attributeName, modelType); + modelBuildOperations.add(builder); + return builder; + } + + public AttributeBuilder integerAttribute(String attributeName) { + IntegerAttributeBuilder builder = new IntegerAttributeBuilder(attributeName, modelType); + modelBuildOperations.add(builder); + return builder; + } + + public AttributeBuilder doubleAttribute(String attributeName) { + DoubleAttributeBuilder builder = new DoubleAttributeBuilder(attributeName, modelType); + modelBuildOperations.add(builder); + return builder; + } + + public > AttributeBuilder enumAttribute(String attributeName, Class enumType) { + EnumAttributeBuilder builder = new EnumAttributeBuilder(attributeName, modelType, enumType); + modelBuildOperations.add(builder); + return builder; + } + + public > AttributeBuilder namedEnumAttribute(String attributeName, Class enumType) { + NamedEnumAttributeBuilder builder = new NamedEnumAttributeBuilder(attributeName, modelType, enumType); + modelBuildOperations.add(builder); + return builder; + } + + public ModelElementType build() { + model.registerType(modelType, instanceType); + return modelType; + } + + public ModelElementTypeBuilder abstractType() { + modelType.setAbstract(true); + return this; + } + + public SequenceBuilder sequence() { + SequenceBuilderImpl builder = new SequenceBuilderImpl(modelType); + modelBuildOperations.add(builder); + return builder; + } + + public void buildTypeHierarchy(Model model) { + + // build type hierarchy + if(extendedType != null) { + ModelElementTypeImpl extendedModelElementType = (ModelElementTypeImpl) model.getType(extendedType); + if(extendedModelElementType == null) { + throw new ModelException("Type "+modelType+" is defined to extend "+extendedType+" but no such type is defined."); + + } else { + modelType.setBaseType(extendedModelElementType); + extendedModelElementType.registerExtendingType(modelType); + } + } + } + + public void performModelBuild(Model model) { + for (ModelBuildOperation operation : modelBuildOperations) { + operation.performModelBuild(model); + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..bda1825f40609e22835601cbf20c34e73be049fc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeImpl.java @@ -0,0 +1,368 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.ModelImpl; +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.impl.util.ModelTypeException; +import org.camunda.bpm.model.xml.impl.util.ModelUtil; +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.camunda.bpm.model.xml.instance.DomElement; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; + +/** + * @author Daniel Meyer + * + */ +public class ModelElementTypeImpl implements ModelElementType { + + private final ModelImpl model; + + private final String typeName; + + private final Class instanceType; + + private String typeNamespace; + + private ModelElementTypeImpl baseType; + + private final List extendingTypes = new ArrayList(); + + private final List> attributes = new ArrayList>(); + + private final List childElementTypes = new ArrayList(); + + private final List> childElementCollections = new ArrayList>(); + + private ModelTypeInstanceProvider instanceProvider; + + private boolean isAbstract; + + public ModelElementTypeImpl(ModelImpl model, String name, Class instanceType) { + this.model = model; + this.typeName = name; + this.instanceType = instanceType; + } + + public ModelElementInstance newInstance(ModelInstance modelInstance) { + ModelInstanceImpl modelInstanceImpl = (ModelInstanceImpl) modelInstance; + DomDocument document = modelInstanceImpl.getDocument(); + DomElement domElement = document.createElement(typeNamespace, typeName); + return newInstance(modelInstanceImpl, domElement); + } + + public ModelElementInstance newInstance(ModelInstanceImpl modelInstance, DomElement domElement) { + ModelTypeInstanceContext modelTypeInstanceContext = new ModelTypeInstanceContext(domElement, modelInstance, this); + return createModelElementInstance(modelTypeInstanceContext); + } + + public void registerAttribute(Attribute attribute) { + if (!attributes.contains(attribute)) { + attributes.add(attribute); + } + } + + public void registerChildElementType(ModelElementType childElementType) { + if (!childElementTypes.contains(childElementType)) { + childElementTypes.add(childElementType); + } + } + + public void registerChildElementCollection(ChildElementCollection childElementCollection) { + if (!childElementCollections.contains(childElementCollection)) { + childElementCollections.add(childElementCollection); + } + } + + public void registerExtendingType(ModelElementType modelType) { + if (!extendingTypes.contains(modelType)) { + extendingTypes.add(modelType); + } + } + + protected ModelElementInstance createModelElementInstance(ModelTypeInstanceContext instanceContext) { + if (isAbstract) { + throw new ModelTypeException("Model element type " + getTypeName() + " is abstract and no instances can be created."); + } + else { + return instanceProvider.newInstance(instanceContext); + } + } + + public final List> getAttributes() { + return attributes; + } + + public String getTypeName() { + return typeName; + } + + public Class getInstanceType() { + return instanceType; + } + + public void setTypeNamespace(String typeNamespace) { + this.typeNamespace = typeNamespace; + } + + public String getTypeNamespace() { + return typeNamespace; + } + + public void setBaseType(ModelElementTypeImpl baseType) { + if (this.baseType == null) { + this.baseType = baseType; + } + else if (!this.baseType.equals(baseType)) { + throw new ModelException("Type can not have multiple base types. " + this.getClass() + " already extends type " + this.baseType.getClass() + + " and can not also extend type " + baseType.getClass()); + } + } + + public void setInstanceProvider(ModelTypeInstanceProvider instanceProvider) { + this.instanceProvider = instanceProvider; + } + public boolean isAbstract() { + return isAbstract; + } + + public void setAbstract(boolean isAbstract) { + this.isAbstract = isAbstract; + } + + public Collection getExtendingTypes() { + return Collections.unmodifiableCollection(extendingTypes); + } + + public Collection getAllExtendingTypes() { + HashSet extendingTypes = new HashSet(); + extendingTypes.add(this); + resolveExtendingTypes(extendingTypes); + return extendingTypes; + } + + /** + * Resolve all types recursively which are extending this type + * + * @param allExtendingTypes set of calculated extending types + */ + public void resolveExtendingTypes(Set allExtendingTypes) { + for(ModelElementType modelElementType : extendingTypes) { + ModelElementTypeImpl modelElementTypeImpl = (ModelElementTypeImpl) modelElementType; + if (!allExtendingTypes.contains(modelElementTypeImpl)) { + allExtendingTypes.add(modelElementType); + modelElementTypeImpl.resolveExtendingTypes(allExtendingTypes); + } + } + } + + /** + * Resolve all types which are base types of this type + * + * @param baseTypes list of calculated base types + */ + public void resolveBaseTypes(List baseTypes) { + if (baseType != null) { + baseTypes.add(baseType); + baseType.resolveBaseTypes(baseTypes); + } + } + + + public ModelElementType getBaseType() { + return baseType; + } + + public Model getModel() { + return model; + } + + public List getChildElementTypes() { + return childElementTypes; + } + + public List getAllChildElementTypes() { + List allChildElementTypes = new ArrayList(); + if (baseType != null) { + allChildElementTypes.addAll(baseType.getAllChildElementTypes()); + } + allChildElementTypes.addAll(childElementTypes); + return allChildElementTypes; + } + + public List> getChildElementCollections() { + return childElementCollections; + } + + public List> getAllChildElementCollections() { + List> allChildElementCollections = new ArrayList>(); + if (baseType != null) { + allChildElementCollections.addAll(baseType.getAllChildElementCollections()); + } + allChildElementCollections.addAll(childElementCollections); + return allChildElementCollections; + } + + public Collection getInstances(ModelInstance modelInstance) { + ModelInstanceImpl modelInstanceImpl = (ModelInstanceImpl) modelInstance; + DomDocument document = modelInstanceImpl.getDocument(); + + List elements = getElementsByNameNs(document, typeNamespace); + + List resultList = new ArrayList(); + for (DomElement element : elements) { + resultList.add(ModelUtil.getModelElement(element, modelInstanceImpl, this)); + } + return resultList; + } + + protected List getElementsByNameNs(DomDocument document, String namespaceURI) { + List elements = document.getElementsByNameNs(namespaceURI, typeName); + + if (elements.isEmpty()) { + Set alternativeNamespaces = getModel().getAlternativeNamespaces(namespaceURI); + + if (alternativeNamespaces != null) + { + Iterator namespaceIt = alternativeNamespaces.iterator(); + while (elements.isEmpty() && namespaceIt.hasNext()) { + elements = getElementsByNameNs(document, namespaceIt.next()); + } + } + } + + return elements; + } + + /** + * Test if a element type is a base type of this type. So this type extends the given element type. + * + * @param elementType the element type to test + * @return true if {@code childElementTypeClass} is a base type of this type, else otherwise + */ + public boolean isBaseTypeOf(ModelElementType elementType) { + if (this.equals(elementType)) { + return true; + } + else { + Collection baseTypes = ModelUtil.calculateAllBaseTypes(elementType); + return baseTypes.contains(this); + } + } + + /** + * Returns a list of all attributes, including the attributes of all base types. + * + * @return the list of all attributes + */ + public Collection> getAllAttributes() { + List> allAttributes = new ArrayList>(); + allAttributes.addAll(getAttributes()); + Collection baseTypes = ModelUtil.calculateAllBaseTypes(this); + for (ModelElementType baseType : baseTypes) { + allAttributes.addAll(baseType.getAttributes()); + } + return allAttributes; + } + + /** + * Return the attribute for the attribute name + * + * @param attributeName the name of the attribute + * @return the attribute or null if it not exists + */ + public Attribute getAttribute(String attributeName) { + for (Attribute attribute : getAllAttributes()) { + if (attribute.getAttributeName().equals(attributeName)) { + return attribute; + } + } + return null; + } + + public ChildElementCollection getChildElementCollection(ModelElementType childElementType) { + for (ChildElementCollection childElementCollection : getChildElementCollections()) { + if (childElementType.equals(childElementCollection.getChildElementType(model))) { + return childElementCollection; + } + } + return null; + } + + @Override + public int hashCode() { + int prime = 31; + int result = 1; + result = prime * result + ((model == null) ? 0 : model.hashCode()); + result = prime * result + ((typeName == null) ? 0 : typeName.hashCode()); + result = prime * result + ((typeNamespace == null) ? 0 : typeNamespace.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ModelElementTypeImpl other = (ModelElementTypeImpl) obj; + if (model == null) { + if (other.model != null) { + return false; + } + } else if (!model.equals(other.model)) { + return false; + } + if (typeName == null) { + if (other.typeName != null) { + return false; + } + } else if (!typeName.equals(other.typeName)) { + return false; + } + if (typeNamespace == null) { + if (other.typeNamespace != null) { + return false; + } + } else if (!typeNamespace.equals(other.typeNamespace)) { + return false; + } + return true; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/AttributeBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/AttributeBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..744d292ba6d37c70b9003fed28ff3a285d45d34d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/AttributeBuilderImpl.java @@ -0,0 +1,72 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.impl.ModelBuildOperation; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.attribute.AttributeBuilder; + + +/** + * + * @author Daniel Meyer + * + */ +public abstract class AttributeBuilderImpl implements AttributeBuilder, ModelBuildOperation { + + private final AttributeImpl attribute; + private final ModelElementTypeImpl modelType; + + AttributeBuilderImpl(String attributeName, ModelElementTypeImpl modelType, AttributeImpl attribute) { + this.modelType = modelType; + this.attribute = attribute; + attribute.setAttributeName(attributeName); + } + + public AttributeBuilder namespace(String namespaceUri) { + attribute.setNamespaceUri(namespaceUri); + return this; + } + + public AttributeBuilder idAttribute() { + attribute.setId(); + return this; + } + + + public AttributeBuilder defaultValue(T defaultValue) { + attribute.setDefaultValue(defaultValue); + return this; + } + + public AttributeBuilder required() { + attribute.setRequired(true); + return this; + } + + public Attribute build() { + modelType.registerAttribute(attribute); + return attribute; + } + + public void performModelBuild(Model model) { + // do nothing + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/AttributeImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/AttributeImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..50cc77adc3b7a8b5b3a00f18b96513c85f0b93ca --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/AttributeImpl.java @@ -0,0 +1,243 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.impl.type.reference.ReferenceImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.reference.Reference; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +/** + *

Base class for implementing primitive value attributes

+ * + * @author Daniel Meyer + * + */ +public abstract class AttributeImpl implements Attribute { + + /** the local name of the attribute */ + private String attributeName; + + /** the namespace for this attribute */ + private String namespaceUri; + + /** the default value for this attribute: the default value is returned + * by the {@link #getValue(ModelElementInstance)} method in case the attribute is not set on the + * domElement. + */ + private T defaultValue; + + private boolean isRequired = false; + + private boolean isIdAttribute = false; + + private final List> outgoingReferences = new ArrayList>(); + + private final List> incomingReferences = new ArrayList>(); + + private final ModelElementType owningElementType; + + AttributeImpl(ModelElementType owningElementType) { + this.owningElementType = owningElementType; + } + + /** + * to be implemented by subclasses: converts the raw (String) value of the + * attribute to the type required by the model + * + * @return the converted value + */ + protected abstract T convertXmlValueToModelValue(String rawValue); + + /** + * to be implemented by subclasses: converts the raw (String) value of the + * attribute to the type required by the model + * + * @return the converted value + */ + protected abstract String convertModelValueToXmlValue(T modelValue); + + public ModelElementType getOwningElementType() { + return owningElementType; + } + + /** + * returns the value of the attribute. + * + * @return the value of the attribute. + */ + public T getValue(ModelElementInstance modelElement) { + String value; + if(namespaceUri == null) { + value = modelElement.getAttributeValue(attributeName); + } else { + value = modelElement.getAttributeValueNs(namespaceUri, attributeName); + if(value == null) { + Set alternativeNamespaces = owningElementType.getModel().getAlternativeNamespaces(namespaceUri); + + if (alternativeNamespaces != null) { + Iterator namespaceIt = alternativeNamespaces.iterator(); + + while (value == null && namespaceIt.hasNext()) { + value = modelElement.getAttributeValueNs(namespaceIt.next(), attributeName); + } + } + } + } + + // default value + if (value == null && defaultValue != null) { + return defaultValue; + } else { + return convertXmlValueToModelValue(value); + } + } + + /** + * sets the value of the attribute. + * + * the value of the attribute. + */ + public void setValue(ModelElementInstance modelElement, T value) { + setValue(modelElement, value, true); + } + + @Override + public void setValue(ModelElementInstance modelElement, T value, boolean withReferenceUpdate) { + String xmlValue = convertModelValueToXmlValue(value); + if(namespaceUri == null) { + modelElement.setAttributeValue(attributeName, xmlValue, + isIdAttribute, withReferenceUpdate); + } else { + modelElement.setAttributeValueNs(namespaceUri, attributeName, + xmlValue, isIdAttribute, withReferenceUpdate); + } + } + + public void updateIncomingReferences(ModelElementInstance modelElement, String newIdentifier, String oldIdentifier) { + if (!incomingReferences.isEmpty()) { + for (Reference incomingReference : incomingReferences) { + ((ReferenceImpl) incomingReference).referencedElementUpdated(modelElement, oldIdentifier, newIdentifier); + } + } + } + + public T getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(T defaultValue) { + this.defaultValue = defaultValue; + } + + + public boolean isRequired() { + return isRequired; + } + + /** + */ + public void setRequired(boolean required) { + this.isRequired = required; + } + + /** + * @param namespaceUri the namespaceUri to set + */ + public void setNamespaceUri(String namespaceUri) { + this.namespaceUri = namespaceUri; + } + + /** + * @return the namespaceUri + */ + public String getNamespaceUri() { + return namespaceUri; + } + + public boolean isIdAttribute() { + return isIdAttribute; + } + + /** + * Indicate whether this attribute is an Id attribute + * + */ + public void setId() { + this.isIdAttribute = true; + } + + /** + * @return the attributeName + */ + public String getAttributeName() { + return attributeName; + } + + /** + * @param attributeName the attributeName to set + */ + public void setAttributeName(String attributeName) { + this.attributeName = attributeName; + } + + public void removeAttribute(ModelElementInstance modelElement) { + if (namespaceUri == null) { + modelElement.removeAttribute(attributeName); + } + else { + modelElement.removeAttributeNs(namespaceUri, attributeName); + } + } + + public void unlinkReference(ModelElementInstance modelElement, Object referenceIdentifier) { + if (!incomingReferences.isEmpty()) { + for (Reference incomingReference : incomingReferences) { + ((ReferenceImpl) incomingReference).referencedElementRemoved(modelElement, referenceIdentifier); + } + } + } + + /** + * @return the incomingReferences + */ + public List> getIncomingReferences() { + return incomingReferences; + } + + /** + * @return the outgoingReferences + */ + public List> getOutgoingReferences() { + return outgoingReferences; + } + + public void registerOutgoingReference(Reference ref) { + outgoingReferences.add(ref); + } + + public void registerIncoming(Reference ref) { + incomingReferences.add(ref); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/BooleanAttribute.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/BooleanAttribute.java new file mode 100644 index 0000000000000000000000000000000000000000..193b41be530de82117aafcbc39de51425639a487 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/BooleanAttribute.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.impl.util.ModelUtil; +import org.camunda.bpm.model.xml.type.ModelElementType; + +/** + *

class for providing Boolean value attributes. Takes care of type conversion and + * the interaction with the underlying Xml model model.

+ * + * @author Daniel Meyer + * + */ +public class BooleanAttribute extends AttributeImpl { + + public BooleanAttribute(ModelElementType owningElementType) { + super(owningElementType); + } + + protected Boolean convertXmlValueToModelValue(String rawValue) { + return ModelUtil.valueAsBoolean(rawValue); + } + + protected String convertModelValueToXmlValue(Boolean modelValue) { + return ModelUtil.valueAsString(modelValue); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/BooleanAttributeBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/BooleanAttributeBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..248f83000e1a4542ee29d479b39431af01814400 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/BooleanAttributeBuilder.java @@ -0,0 +1,34 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; + + +/** + *

Builder for building {@link BooleanAttribute BooleanAttributes}

+ * + * @author Daniel Meyer + * + */ +public class BooleanAttributeBuilder extends AttributeBuilderImpl { + + public BooleanAttributeBuilder(String attributeName, ModelElementTypeImpl modelType) { + super(attributeName, modelType, new BooleanAttribute(modelType)); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/DoubleAttribute.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/DoubleAttribute.java new file mode 100644 index 0000000000000000000000000000000000000000..ce2ba5c50e8f934fce8ec51e5fa6a2ca63edc818 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/DoubleAttribute.java @@ -0,0 +1,47 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.type.ModelElementType; + +/** + * @author Sebastian Menski + */ +public class DoubleAttribute extends AttributeImpl { + + DoubleAttribute(ModelElementType owningElementType) { + super(owningElementType); + } + + protected Double convertXmlValueToModelValue(String rawValue) { + if (rawValue != null) { + try { + return Double.parseDouble(rawValue); + } + catch (NumberFormatException e) { + return null; + } + } + else { + return null; + } + } + + protected String convertModelValueToXmlValue(Double modelValue) { + return modelValue.toString(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/DoubleAttributeBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/DoubleAttributeBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..bae49d8214e78a3251aa1c9b4f49769209a32137 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/DoubleAttributeBuilder.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; + +/** + * @author Sebastian Menski + */ +public class DoubleAttributeBuilder extends AttributeBuilderImpl { + + public DoubleAttributeBuilder(String attributeName, ModelElementTypeImpl modelType) { + super(attributeName, modelType, new DoubleAttribute(modelType)); + } + + @Override + public DoubleAttributeBuilder namespace(String namespaceUri) { + return (DoubleAttributeBuilder) super.namespace(namespaceUri); + } + + @Override + public DoubleAttributeBuilder defaultValue(Double defaultValue) { + return (DoubleAttributeBuilder) super.defaultValue(defaultValue); + } + + @Override + public DoubleAttributeBuilder required() { + return (DoubleAttributeBuilder) super.required(); + } + + @Override + public DoubleAttributeBuilder idAttribute() { + return (DoubleAttributeBuilder) super.idAttribute(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/EnumAttribute.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/EnumAttribute.java new file mode 100644 index 0000000000000000000000000000000000000000..bdd16d5bd8dfb941d5318ba73432dd054957f75b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/EnumAttribute.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.type.ModelElementType; + +/** + *

An attribute exposing an Enum value

+ * + * @author Daniel Meyer + * + */ +public class EnumAttribute> extends AttributeImpl { + + private final Class type; + + public EnumAttribute(ModelElementType owningElementType, Class type) { + super(owningElementType); + this.type = type; + } + + protected T convertXmlValueToModelValue(String rawValue) { + if (rawValue != null) { + return Enum.valueOf(type, rawValue); + } + else { + return null; + } + } + + protected String convertModelValueToXmlValue(T modelValue) { + return modelValue.name(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/EnumAttributeBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/EnumAttributeBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..0bdc91d381bb2cff6e6773959c2be76040518dab --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/EnumAttributeBuilder.java @@ -0,0 +1,50 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; + +/** + * @author Daniel Meyer + * + */ +public class EnumAttributeBuilder> extends AttributeBuilderImpl { + + public EnumAttributeBuilder(String attributeName, ModelElementTypeImpl modelType, Class type) { + super(attributeName, modelType, new EnumAttribute(modelType, type)); + } + + @Override + public EnumAttributeBuilder namespace(String namespaceUri) { + return (EnumAttributeBuilder) super.namespace(namespaceUri); + } + + @Override + public EnumAttributeBuilder defaultValue(T defaultValue) { + return (EnumAttributeBuilder) super.defaultValue(defaultValue); + } + + @Override + public EnumAttributeBuilder required() { + return (EnumAttributeBuilder) super.required(); + } + + @Override + public EnumAttributeBuilder idAttribute() { + return (EnumAttributeBuilder) super.idAttribute(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/IntegerAttribute.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/IntegerAttribute.java new file mode 100644 index 0000000000000000000000000000000000000000..0abd7b7ff3d8cca0ffa648199d0b69aa6c616a7e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/IntegerAttribute.java @@ -0,0 +1,42 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.type.ModelElementType; + +/** + * @author Sebastian Menski + */ +public class IntegerAttribute extends AttributeImpl { + + IntegerAttribute(ModelElementType owningElementType) { + super(owningElementType); + } + + protected Integer convertXmlValueToModelValue(String rawValue) { + try { + return Integer.parseInt(rawValue); + } + catch (NumberFormatException e) { + return null; + } + } + + protected String convertModelValueToXmlValue(Integer modelValue) { + return modelValue.toString(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/IntegerAttributeBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/IntegerAttributeBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..c95d4a6d8af1f59bae91923e7ac2532e1a65e04d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/IntegerAttributeBuilder.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; + +/** + * @author Sebastian Menski + */ +public class IntegerAttributeBuilder extends AttributeBuilderImpl { + + public IntegerAttributeBuilder(String attributeName, ModelElementTypeImpl modelType) { + super(attributeName, modelType, new IntegerAttribute(modelType)); + } + + @Override + public IntegerAttributeBuilder namespace(String namespaceUri) { + return (IntegerAttributeBuilder) super.namespace(namespaceUri); + } + + @Override + public IntegerAttributeBuilder defaultValue(Integer defaultValue) { + return (IntegerAttributeBuilder) super.defaultValue(defaultValue); + } + + @Override + public IntegerAttributeBuilder required() { + return (IntegerAttributeBuilder) super.required(); + } + + @Override + public IntegerAttributeBuilder idAttribute() { + return (IntegerAttributeBuilder) super.idAttribute(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/NamedEnumAttribute.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/NamedEnumAttribute.java new file mode 100644 index 0000000000000000000000000000000000000000..2e3e7bcb20a301141d4f0c7b8618e1be39585eae --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/NamedEnumAttribute.java @@ -0,0 +1,47 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.type.ModelElementType; + +public class NamedEnumAttribute> extends AttributeImpl { + + protected final Class type; + + public NamedEnumAttribute(ModelElementType owningElementType, Class type) { + super(owningElementType); + this.type = type; + } + + @SuppressWarnings("unchecked") + protected T convertXmlValueToModelValue(String rawValue) { + T[] enumConstants = type.getEnumConstants(); + if (rawValue != null && enumConstants != null) { + for (T enumConstant : enumConstants) { + if (rawValue.equals(enumConstant.toString())) { + return enumConstant; + } + } + } + return null; + } + + protected String convertModelValueToXmlValue(T modelValue) { + return modelValue.toString(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/NamedEnumAttributeBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/NamedEnumAttributeBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..db90a347704bd8d1e5238743b787273abe2bc6a4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/NamedEnumAttributeBuilder.java @@ -0,0 +1,47 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; + +public class NamedEnumAttributeBuilder> extends AttributeBuilderImpl { + + public NamedEnumAttributeBuilder(String attributeName, ModelElementTypeImpl modelType, Class type) { + super(attributeName, modelType, new NamedEnumAttribute(modelType, type)); + } + + @Override + public NamedEnumAttributeBuilder namespace(String namespaceUri) { + return (NamedEnumAttributeBuilder) super.namespace(namespaceUri); + } + + @Override + public NamedEnumAttributeBuilder defaultValue(T defaultValue) { + return (NamedEnumAttributeBuilder) super.defaultValue(defaultValue); + } + + @Override + public NamedEnumAttributeBuilder required() { + return (NamedEnumAttributeBuilder) super.required(); + } + + @Override + public NamedEnumAttributeBuilder idAttribute() { + return (NamedEnumAttributeBuilder) super.idAttribute(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/StringAttribute.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/StringAttribute.java new file mode 100644 index 0000000000000000000000000000000000000000..b45df3267d9d2de6fba800df38a7ec609376c321 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/StringAttribute.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.type.ModelElementType; + +/** + *

Base class for String attributes + * + * @author Daniel Meyer + * + */ +public class StringAttribute extends AttributeImpl { + + public StringAttribute(ModelElementType owningElementType) { + super(owningElementType); + } + + protected String convertXmlValueToModelValue(String rawValue) { + return rawValue; + } + + protected String convertModelValueToXmlValue(String modelValue) { + return modelValue; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/StringAttributeBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/StringAttributeBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..2060b0f990777798cfba7138fef828a379a869b3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/StringAttributeBuilderImpl.java @@ -0,0 +1,110 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.attribute; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.impl.ModelBuildOperation; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.impl.type.reference.AttributeReferenceBuilderImpl; +import org.camunda.bpm.model.xml.impl.type.reference.AttributeReferenceCollectionBuilderImpl; +import org.camunda.bpm.model.xml.impl.type.reference.QNameAttributeReferenceBuilderImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.attribute.StringAttributeBuilder; +import org.camunda.bpm.model.xml.type.reference.AttributeReferenceBuilder; +import org.camunda.bpm.model.xml.type.reference.AttributeReferenceCollection; +import org.camunda.bpm.model.xml.type.reference.AttributeReferenceCollectionBuilder; + + +/** + * + * @author Daniel Meyer + * + */ +public class StringAttributeBuilderImpl extends AttributeBuilderImpl implements StringAttributeBuilder { + + private AttributeReferenceBuilder referenceBuilder; + + public StringAttributeBuilderImpl(String attributeName, ModelElementTypeImpl modelType) { + super(attributeName, modelType, new StringAttribute(modelType)); + } + + @Override + public StringAttributeBuilder namespace(String namespaceUri) { + return (StringAttributeBuilder) super.namespace(namespaceUri); + } + + @Override + public StringAttributeBuilder defaultValue(String defaultValue) { + return (StringAttributeBuilder) super.defaultValue(defaultValue); + } + + @Override + public StringAttributeBuilder required() { + return (StringAttributeBuilder) super.required(); + } + + @Override + public StringAttributeBuilder idAttribute() { + return (StringAttributeBuilder) super.idAttribute(); + } + + /** + * Create a new {@link AttributeReferenceBuilder} for the reference source element instance + * + * @param referenceTargetElement the reference target model element instance + * @return the new attribute reference builder + */ + public AttributeReferenceBuilder qNameAttributeReference(Class referenceTargetElement) { + AttributeImpl attribute = (AttributeImpl) build(); + AttributeReferenceBuilderImpl referenceBuilder = new QNameAttributeReferenceBuilderImpl(attribute, referenceTargetElement); + setAttributeReference(referenceBuilder); + return referenceBuilder; + } + + public AttributeReferenceBuilder idAttributeReference(Class referenceTargetElement) { + AttributeImpl attribute = (AttributeImpl) build(); + AttributeReferenceBuilderImpl referenceBuilder = new AttributeReferenceBuilderImpl(attribute, referenceTargetElement); + setAttributeReference(referenceBuilder); + return referenceBuilder; + } + + @SuppressWarnings("rawtypes") + public AttributeReferenceCollectionBuilder idAttributeReferenceCollection(Class referenceTargetElement, Class attributeReferenceCollection) { + AttributeImpl attribute = (AttributeImpl) build(); + AttributeReferenceCollectionBuilder referenceBuilder = new AttributeReferenceCollectionBuilderImpl(attribute, referenceTargetElement, attributeReferenceCollection); + setAttributeReference(referenceBuilder); + return referenceBuilder; + } + + protected void setAttributeReference(AttributeReferenceBuilder referenceBuilder) { + if (this.referenceBuilder != null) { + throw new ModelException("An attribute cannot have more than one reference"); + } + this.referenceBuilder = referenceBuilder; + } + + + @Override + public void performModelBuild(Model model) { + super.performModelBuild(model); + if (referenceBuilder != null) { + ((ModelBuildOperation) referenceBuilder).performModelBuild(model); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..30c269052b65068c544a014a2289597b1ed8d2e2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementBuilderImpl.java @@ -0,0 +1,88 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.child; + +import org.camunda.bpm.model.xml.impl.type.reference.ElementReferenceBuilderImpl; +import org.camunda.bpm.model.xml.impl.type.reference.QNameElementReferenceBuilderImpl; +import org.camunda.bpm.model.xml.impl.type.reference.UriElementReferenceBuilderImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.ChildElementBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceBuilder; + +/** + * @author Daniel Meyer + * + */ +public class ChildElementBuilderImpl extends ChildElementCollectionBuilderImpl implements ChildElementBuilder { + + public ChildElementBuilderImpl(Class childElementTypeClass, ModelElementType parentElementType) { + super(childElementTypeClass, parentElementType); + } + + @Override + protected ChildElementCollectionImpl createCollectionInstance() { + return new ChildElementImpl(childElementType, parentElementType); + } + + public ChildElementBuilder immutable() { + super.immutable(); + return this; + } + + public ChildElementBuilder required() { + super.required(); + return this; + } + + public ChildElementBuilder minOccurs(int i) { + super.minOccurs(i); + return this; + } + + public ChildElementBuilder maxOccurs(int i) { + super.maxOccurs(i); + return this; + } + + public ChildElement build() { + return (ChildElement) super.build(); + } + + public ElementReferenceBuilder qNameElementReference(Class referenceTargetType) { + ChildElementImpl child = (ChildElementImpl) build(); + QNameElementReferenceBuilderImpl builder = new QNameElementReferenceBuilderImpl(childElementType, referenceTargetType, child); + setReferenceBuilder(builder); + return builder; + } + + public ElementReferenceBuilder idElementReference(Class referenceTargetType) { + ChildElementImpl child = (ChildElementImpl) build(); + ElementReferenceBuilderImpl builder = new ElementReferenceBuilderImpl(childElementType, referenceTargetType, child); + setReferenceBuilder(builder); + return builder; + } + + public ElementReferenceBuilder uriElementReference(Class referenceTargetType) { + ChildElementImpl child = (ChildElementImpl) build(); + ElementReferenceBuilderImpl builder = new UriElementReferenceBuilderImpl(childElementType, referenceTargetType, child); + setReferenceBuilder(builder); + return builder; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementCollectionBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementCollectionBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..367edca0916b7a20cce42d0fd6ec736358fd7f1f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementCollectionBuilderImpl.java @@ -0,0 +1,134 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.child; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.impl.ModelBuildOperation; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.impl.type.reference.ElementReferenceCollectionBuilderImpl; +import org.camunda.bpm.model.xml.impl.type.reference.IdsElementReferenceCollectionBuilderImpl; +import org.camunda.bpm.model.xml.impl.type.reference.QNameElementReferenceCollectionBuilderImpl; +import org.camunda.bpm.model.xml.impl.type.reference.UriElementReferenceCollectionBuilderImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.ChildElementCollectionBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollectionBuilder; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Daniel Meyer + * + */ +public class ChildElementCollectionBuilderImpl implements ChildElementCollectionBuilder, ModelBuildOperation { + + /** The {@link ModelElementType} of the element containing the collection */ + protected final ModelElementTypeImpl parentElementType; + private final ChildElementCollectionImpl collection; + protected final Class childElementType; + + private ElementReferenceCollectionBuilder referenceBuilder; + + private final List modelBuildOperations = new ArrayList(); + + public ChildElementCollectionBuilderImpl(Class childElementTypeClass, ModelElementType parentElementType) { + this.childElementType = childElementTypeClass; + this.parentElementType = (ModelElementTypeImpl) parentElementType; + this.collection = createCollectionInstance(); + + } + + protected ChildElementCollectionImpl createCollectionInstance() { + return new ChildElementCollectionImpl(childElementType, parentElementType); + } + + public ChildElementCollectionBuilder immutable() { + collection.setImmutable(); + return this; + } + + public ChildElementCollectionBuilder required() { + collection.setMinOccurs(1); + return this; + } + + public ChildElementCollectionBuilder maxOccurs(int i) { + collection.setMaxOccurs(i); + return this; + } + + public ChildElementCollectionBuilder minOccurs(int i) { + collection.setMinOccurs(i); + return this; + } + + public ChildElementCollection build() { + return collection; + } + + public ElementReferenceCollectionBuilder qNameElementReferenceCollection(Class referenceTargetType) { + ChildElementCollectionImpl collection = (ChildElementCollectionImpl) build(); + QNameElementReferenceCollectionBuilderImpl builder = new QNameElementReferenceCollectionBuilderImpl(childElementType, referenceTargetType, collection); + setReferenceBuilder(builder); + return builder; + } + + public ElementReferenceCollectionBuilder idElementReferenceCollection(Class referenceTargetType) { + ChildElementCollectionImpl collection = (ChildElementCollectionImpl) build(); + ElementReferenceCollectionBuilder builder = new ElementReferenceCollectionBuilderImpl(childElementType, referenceTargetType, collection); + setReferenceBuilder(builder); + return builder; + } + + public ElementReferenceCollectionBuilder idsElementReferenceCollection(Class referenceTargetType) { + ChildElementCollectionImpl collection = (ChildElementCollectionImpl) build(); + ElementReferenceCollectionBuilder builder = new IdsElementReferenceCollectionBuilderImpl(childElementType, referenceTargetType, collection); + setReferenceBuilder(builder); + return builder; + } + + public ElementReferenceCollectionBuilder uriElementReferenceCollection(Class referenceTargetType) { + ChildElementCollectionImpl collection = (ChildElementCollectionImpl) build(); + ElementReferenceCollectionBuilder builder = new UriElementReferenceCollectionBuilderImpl(childElementType, referenceTargetType, collection); + setReferenceBuilder(builder); + return builder; + } + + protected void setReferenceBuilder(ElementReferenceCollectionBuilder referenceBuilder) { + if (this.referenceBuilder != null) { + throw new ModelException("An collection cannot have more than one reference"); + } + this.referenceBuilder = referenceBuilder; + modelBuildOperations.add(referenceBuilder); + } + + public void performModelBuild(Model model) { + ModelElementType elementType = model.getType(childElementType); + if(elementType == null) { + throw new ModelException(parentElementType +" declares undefined child element of type "+childElementType+"."); + } + parentElementType.registerChildElementType(elementType); + parentElementType.registerChildElementCollection(collection); + for (ModelBuildOperation modelBuildOperation : modelBuildOperations) { + modelBuildOperation.performModelBuild(model); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementCollectionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementCollectionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0321b1c4281f0246fee6d41b2dcecc2d0cf1e5ea --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementCollectionImpl.java @@ -0,0 +1,235 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.child; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.UnsupportedModelOperationException; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.impl.util.ModelUtil; +import org.camunda.bpm.model.xml.instance.DomElement; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; + +import java.util.Collection; +import java.util.Iterator; + +/** + *

This collection is a view on an the children of a Model Element.

+ * + * @author Daniel Meyer + * + */ +public class ChildElementCollectionImpl implements ChildElementCollection { + + protected final Class childElementTypeClass; + + /** the containing type of the collection */ + private final ModelElementType parentElementType; + + /** the minimal count of child elements in the collection */ + private int minOccurs = 0; + + /** + * the maximum count of child elements in the collection. + * An unbounded collection has a negative maxOccurs. + */ + protected int maxOccurs = -1; + + /** indicates whether this collection is mutable. */ + private boolean isMutable = true; + + public ChildElementCollectionImpl(Class childElementTypeClass, ModelElementTypeImpl parentElementType) { + this.childElementTypeClass = childElementTypeClass; + this.parentElementType = parentElementType; + } + + public void setImmutable() { + setMutable(false); + } + + public void setMutable(boolean isMutable) { + this.isMutable = isMutable; + } + + public boolean isImmutable() { + return !isMutable; + } + + // view ///////////////////////////////////////////////////////// + + /** + * Internal method providing access to the view represented by this collection. + * + * @return the view represented by this collection + */ + private Collection getView(ModelElementInstanceImpl modelElement) { + return modelElement.getDomElement().getChildElementsByType(modelElement.getModelInstance(), childElementTypeClass); + } + + public int getMinOccurs() { + return minOccurs; + } + + public void setMinOccurs(int minOccurs) { + this.minOccurs = minOccurs; + } + + public int getMaxOccurs() { + return maxOccurs; + } + + public ModelElementType getChildElementType(Model model) { + return model.getType(childElementTypeClass); + } + + public Class getChildElementTypeClass() { + return childElementTypeClass; + } + + public ModelElementType getParentElementType() { + return parentElementType; + } + + public void setMaxOccurs(int maxOccurs) { + this.maxOccurs = maxOccurs; + } + + /** the "add" operation used by the collection */ + private void performAddOperation(ModelElementInstanceImpl modelElement, T e) { + modelElement.addChildElement(e); + } + + /** the "remove" operation used by this collection */ + private boolean performRemoveOperation(ModelElementInstanceImpl modelElement, Object e) { + return modelElement.removeChildElement((ModelElementInstanceImpl)e); + } + + /** the "clear" operation used by this collection */ + private void performClearOperation(ModelElementInstanceImpl modelElement, Collection elementsToRemove) { + Collection modelElements = ModelUtil.getModelElementCollection(elementsToRemove, modelElement.getModelInstance()); + for (ModelElementInstance element : modelElements) { + modelElement.removeChildElement(element); + } + } + + public Collection get(ModelElementInstance element) { + + final ModelElementInstanceImpl modelElement = (ModelElementInstanceImpl) element; + + return new Collection() { + + public boolean contains(Object o) { + if(o == null) { + return false; + + } else if(!(o instanceof ModelElementInstanceImpl)) { + return false; + + } else { + return getView(modelElement).contains(((ModelElementInstanceImpl)o).getDomElement()); + + } + } + + public boolean containsAll(Collection c) { + for (Object elementToCheck : c) { + if(!contains(elementToCheck)) { + return false; + } + } + return true; + } + + public boolean isEmpty() { + return getView(modelElement).isEmpty(); + } + + public Iterator iterator() { + Collection modelElementCollection = ModelUtil.getModelElementCollection(getView(modelElement), modelElement.getModelInstance()); + return modelElementCollection.iterator(); + } + + public Object[] toArray() { + Collection modelElementCollection = ModelUtil.getModelElementCollection(getView(modelElement), modelElement.getModelInstance()); + return modelElementCollection.toArray(); + } + + public U[] toArray(U[] a) { + Collection modelElementCollection = ModelUtil.getModelElementCollection(getView(modelElement), modelElement.getModelInstance()); + return modelElementCollection.toArray(a); + } + + public int size() { + return getView(modelElement).size(); + } + + public boolean add(T e) { + if(!isMutable) { + throw new UnsupportedModelOperationException("add()", "collection is immutable"); + } + performAddOperation(modelElement, e); + return true; + } + + public boolean addAll(Collection c) { + if(!isMutable) { + throw new UnsupportedModelOperationException("addAll()", "collection is immutable"); + } + boolean result = false; + for (T t : c) { + result |= add(t); + } + return result; + } + + public void clear() { + if(!isMutable) { + throw new UnsupportedModelOperationException("clear()", "collection is immutable"); + } + Collection view = getView(modelElement); + performClearOperation(modelElement, view); + } + + public boolean remove(Object e) { + if(!isMutable) { + throw new UnsupportedModelOperationException("remove()", "collection is immutable"); + } + ModelUtil.ensureInstanceOf(e, ModelElementInstanceImpl.class); + return performRemoveOperation(modelElement, e); + } + + public boolean removeAll(Collection c) { + if(!isMutable) { + throw new UnsupportedModelOperationException("removeAll()", "collection is immutable"); + } + boolean result = false; + for (Object t : c) { + result |= remove(t); + } + return result; + } + + public boolean retainAll(Collection c) { + throw new UnsupportedModelOperationException("retainAll()", "not implemented"); + } + + }; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0944405dd2cb22a882a0a6d4b0ae2b380e8cde92 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementImpl.java @@ -0,0 +1,65 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.child; + +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.impl.util.ModelUtil; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.child.ChildElement; + +/** + * Represents a single Child Element (ie. maxOccurs = 1); + * + * @author Daniel Meyer + * + */ +public class ChildElementImpl extends ChildElementCollectionImpl implements ChildElement { + + public ChildElementImpl(Class childElementTypeChild, ModelElementTypeImpl parentElementType) { + super(childElementTypeChild, parentElementType); + this.maxOccurs = 1; + } + + /** the add operation replaces the child */ + private void performAddOperation(ModelElementInstanceImpl modelElement, T e) { + modelElement.setUniqueChildElementByNameNs(e); + } + + public void setChild(ModelElementInstance element, T newChildElement) { + performAddOperation((ModelElementInstanceImpl) element, newChildElement); + } + + @SuppressWarnings("unchecked") + public T getChild(ModelElementInstance element) { + ModelElementInstanceImpl elementInstanceImpl = (ModelElementInstanceImpl)element; + + ModelElementInstance childElement = elementInstanceImpl.getUniqueChildElementByType(childElementTypeClass); + if(childElement != null) { + ModelUtil.ensureInstanceOf(childElement, childElementTypeClass); + return (T) childElement; + } else { + return null; + } + } + + public boolean removeChild(ModelElementInstance element) { + ModelElementInstanceImpl childElement = (ModelElementInstanceImpl) getChild(element); + ModelElementInstanceImpl elementInstanceImpl = (ModelElementInstanceImpl) element; + return elementInstanceImpl.removeChildElement(childElement); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/SequenceBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/SequenceBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..a72c42f515914b18db4cec22e408ec5381070cbc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/child/SequenceBuilderImpl.java @@ -0,0 +1,62 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.child; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.impl.ModelBuildOperation; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.child.ChildElementBuilder; +import org.camunda.bpm.model.xml.type.child.ChildElementCollectionBuilder; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Daniel Meyer + * + */ +public class SequenceBuilderImpl implements SequenceBuilder, ModelBuildOperation { + + private final ModelElementTypeImpl elementType; + + private final List modelBuildOperations = new ArrayList(); + + public SequenceBuilderImpl(ModelElementTypeImpl modelType) { + this.elementType = modelType; + } + + public ChildElementBuilder element(Class childElementType) { + ChildElementBuilderImpl builder = new ChildElementBuilderImpl(childElementType, elementType); + modelBuildOperations.add(builder); + return builder; + } + + public ChildElementCollectionBuilder elementCollection(Class childElementType) { + ChildElementCollectionBuilderImpl builder = new ChildElementCollectionBuilderImpl(childElementType, elementType); + modelBuildOperations.add(builder); + return builder; + } + + public void performModelBuild(Model model) { + for (ModelBuildOperation operation : modelBuildOperations) { + operation.performModelBuild(model); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/AttributeReferenceBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/AttributeReferenceBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..91aa5dfc9b6802065de49bd248c9665128b8e5a1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/AttributeReferenceBuilderImpl.java @@ -0,0 +1,76 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.impl.ModelBuildOperation; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.reference.AttributeReference; +import org.camunda.bpm.model.xml.type.reference.AttributeReferenceBuilder; + +/** + * A builder for a attribute model reference based on a QName + * + * @author Sebastian Menski + * + */ +public class AttributeReferenceBuilderImpl implements AttributeReferenceBuilder, ModelBuildOperation { + + private final AttributeImpl referenceSourceAttribute; + protected AttributeReferenceImpl attributeReferenceImpl; + private final Class referenceTargetElement; + + /** + * Create a new {@link AttributeReferenceBuilderImpl} from the reference source attribute + * to the reference target model element instance + * + * @param referenceSourceAttribute the reference source attribute + * @param referenceTargetElement the reference target model element instance + */ + public AttributeReferenceBuilderImpl(AttributeImpl referenceSourceAttribute, Class referenceTargetElement) { + this.referenceSourceAttribute = referenceSourceAttribute; + this.referenceTargetElement = referenceTargetElement; + this.attributeReferenceImpl = new AttributeReferenceImpl(referenceSourceAttribute); + } + + public AttributeReference build() { + referenceSourceAttribute.registerOutgoingReference(attributeReferenceImpl); + return attributeReferenceImpl; + } + + @SuppressWarnings("unchecked") + public void performModelBuild(Model model) { + // register declaring type as a referencing type of referenced type + ModelElementTypeImpl referenceTargetType = (ModelElementTypeImpl) model.getType(referenceTargetElement); + + // the actual referenced type + attributeReferenceImpl.setReferenceTargetElementType(referenceTargetType); + + // the referenced attribute may be declared on a base type of the referenced type. + AttributeImpl idAttribute = (AttributeImpl) referenceTargetType.getAttribute("id"); + if(idAttribute != null) { + idAttribute.registerIncoming(attributeReferenceImpl); + attributeReferenceImpl.setReferenceTargetAttribute(idAttribute); + } else { + throw new ModelException("Element type " + referenceTargetType.getTypeNamespace() + ":" + referenceTargetType.getTypeName() + " has no id attribute"); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/AttributeReferenceCollectionBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/AttributeReferenceCollectionBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4b1c7a1485e213d42f7385d374a305c5ef6d109d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/AttributeReferenceCollectionBuilderImpl.java @@ -0,0 +1,74 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.impl.ModelBuildOperation; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.reference.AttributeReferenceCollection; +import org.camunda.bpm.model.xml.type.reference.AttributeReferenceCollectionBuilder; + +/** + * @author Roman Smirnov + * @author Sebastian Menski + * + */ +public class AttributeReferenceCollectionBuilderImpl implements AttributeReferenceCollectionBuilder, ModelBuildOperation { + + private final AttributeImpl referenceSourceAttribute; + protected AttributeReferenceCollection attributeReferenceCollection; + private final Class referenceTargetElement; + + @SuppressWarnings({ "unchecked", "rawtypes" }) + public AttributeReferenceCollectionBuilderImpl(AttributeImpl attribute, Class referenceTargetElement, Class attributeReferenceCollection) { + this.referenceSourceAttribute = attribute; + this.referenceTargetElement = referenceTargetElement; + try { + this.attributeReferenceCollection = (AttributeReferenceCollection) attributeReferenceCollection.getConstructor(AttributeImpl.class) + .newInstance(referenceSourceAttribute); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AttributeReferenceCollection build() { + referenceSourceAttribute.registerOutgoingReference(attributeReferenceCollection); + return attributeReferenceCollection; + } + + @SuppressWarnings("unchecked") + public void performModelBuild(Model model) { + // register declaring type as a referencing type of referenced type + ModelElementTypeImpl referenceTargetType = (ModelElementTypeImpl) model.getType(referenceTargetElement); + + // the actual referenced type + attributeReferenceCollection.setReferenceTargetElementType(referenceTargetType); + + // the referenced attribute may be declared on a base type of the referenced type. + AttributeImpl idAttribute = (AttributeImpl) referenceTargetType.getAttribute("id"); + if(idAttribute != null) { + idAttribute.registerIncoming(attributeReferenceCollection); + attributeReferenceCollection.setReferenceTargetAttribute(idAttribute); + } else { + throw new ModelException("Element type " + referenceTargetType.getTypeNamespace() + ":" + referenceTargetType.getTypeName() + " has no id attribute"); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/AttributeReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/AttributeReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..36fda13ca63893d0c0a6555d584d3e887149a239 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/AttributeReferenceImpl.java @@ -0,0 +1,68 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.reference.AttributeReference; + +/** + * @author Sebastian Menski + */ +public class AttributeReferenceImpl extends ReferenceImpl implements AttributeReference { + + protected final AttributeImpl referenceSourceAttribute; + + public AttributeReferenceImpl(AttributeImpl referenceSourceAttribute) { + this.referenceSourceAttribute = referenceSourceAttribute; + } + + public String getReferenceIdentifier(ModelElementInstance referenceSourceElement) { + return referenceSourceAttribute.getValue(referenceSourceElement); + } + + protected void setReferenceIdentifier(ModelElementInstance referenceSourceElement, String referenceIdentifier) { + referenceSourceAttribute.setValue(referenceSourceElement, referenceIdentifier); + } + + /** + * Get the reference source attribute + * + * @return the reference source attribute + */ + public Attribute getReferenceSourceAttribute() { + return referenceSourceAttribute; + } + + public ModelElementType getReferenceSourceElementType() { + return referenceSourceAttribute.getOwningElementType(); + } + + protected void updateReference(ModelElementInstance referenceSourceElement, String oldIdentifier, String newIdentifier) { + String referencingAttributeValue = getReferenceIdentifier(referenceSourceElement); + if(oldIdentifier != null && oldIdentifier.equals(referencingAttributeValue)) { + setReferenceIdentifier(referenceSourceElement, newIdentifier); + } + } + + protected void removeReference(ModelElementInstance referenceSourceElement, ModelElementInstance referenceTargetElement) { + referenceSourceAttribute.removeAttribute(referenceSourceElement); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ElementReferenceBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ElementReferenceBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..b36d05ca2923355d911ead431f989aec24710397 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ElementReferenceBuilderImpl.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.impl.type.child.ChildElementImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.reference.ElementReference; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceBuilder; + +/** + * @author Sebastian Menski + */ +public class ElementReferenceBuilderImpl extends ElementReferenceCollectionBuilderImpl implements ElementReferenceBuilder { + + public ElementReferenceBuilderImpl(Class childElementType, Class referenceTargetClass, ChildElementImpl child) { + super(childElementType, referenceTargetClass, child); + this.elementReferenceCollectionImpl = new ElementReferenceImpl(child); + } + + @SuppressWarnings("unchecked") + public ElementReference build() { + return (ElementReference) elementReferenceCollectionImpl; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ElementReferenceCollectionBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ElementReferenceCollectionBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c42bad383f33f7aee8dd2b94153a55cf86377c84 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ElementReferenceCollectionBuilderImpl.java @@ -0,0 +1,63 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl; +import org.camunda.bpm.model.xml.impl.type.child.ChildElementCollectionImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollection; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollectionBuilder; + +/** + * @author Sebastian Menski + */ +public class ElementReferenceCollectionBuilderImpl implements ElementReferenceCollectionBuilder { + + private final Class childElementType; + private final Class referenceTargetClass; + protected ElementReferenceCollectionImpl elementReferenceCollectionImpl; + + public ElementReferenceCollectionBuilderImpl(Class childElementType, Class referenceTargetClass, ChildElementCollectionImpl collection) { + this.childElementType = childElementType; + this.referenceTargetClass = referenceTargetClass; + this.elementReferenceCollectionImpl = new ElementReferenceCollectionImpl(collection); + } + + public ElementReferenceCollection build() { + return elementReferenceCollectionImpl; + } + + @SuppressWarnings("unchecked") + public void performModelBuild(Model model) { + ModelElementTypeImpl referenceTargetType = (ModelElementTypeImpl) model.getType(referenceTargetClass); + ModelElementTypeImpl referenceSourceType = (ModelElementTypeImpl) model.getType(childElementType); + elementReferenceCollectionImpl.setReferenceTargetElementType(referenceTargetType); + elementReferenceCollectionImpl.setReferenceSourceElementType(referenceSourceType); + + // the referenced attribute may be declared on a base type of the referenced type. + AttributeImpl idAttribute = (AttributeImpl) referenceTargetType.getAttribute("id"); + if (idAttribute != null) { + idAttribute.registerIncoming(elementReferenceCollectionImpl); + elementReferenceCollectionImpl.setReferenceTargetAttribute(idAttribute); + } else { + throw new ModelException("Unable to find id attribute of " + referenceTargetClass); + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ElementReferenceCollectionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ElementReferenceCollectionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..6b2df0015efe4db26279b8451b79c275158bd3b9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ElementReferenceCollectionImpl.java @@ -0,0 +1,246 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.ModelReferenceException; +import org.camunda.bpm.model.xml.UnsupportedModelOperationException; +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.impl.util.ModelUtil; +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.camunda.bpm.model.xml.instance.DomElement; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollection; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +/** + * @author Sebastian Menski + */ +public class ElementReferenceCollectionImpl extends ReferenceImpl implements ElementReferenceCollection { + + private final ChildElementCollection referenceSourceCollection; + private ModelElementTypeImpl referenceSourceType; + + public ElementReferenceCollectionImpl(ChildElementCollection referenceSourceCollection) { + this.referenceSourceCollection = referenceSourceCollection; + } + + public ChildElementCollection getReferenceSourceCollection() { + return referenceSourceCollection; + } + + @Override + protected void setReferenceIdentifier(ModelElementInstance referenceSourceElement, String referenceIdentifier) { + referenceSourceElement.setTextContent(referenceIdentifier); + } + + protected void performAddOperation(ModelElementInstanceImpl referenceSourceParentElement, Target referenceTargetElement) { + ModelInstanceImpl modelInstance = referenceSourceParentElement.getModelInstance(); + String referenceTargetIdentifier = referenceTargetAttribute.getValue(referenceTargetElement); + ModelElementInstance existingElement = modelInstance.getModelElementById(referenceTargetIdentifier); + + if (existingElement == null || !existingElement.equals(referenceTargetElement)) { + throw new ModelReferenceException("Cannot create reference to model element " + referenceTargetElement + +": element is not part of model. Please connect element to the model first."); + } + else { + Collection referenceSourceElements = referenceSourceCollection.get(referenceSourceParentElement); + Source referenceSourceElement = modelInstance.newInstance(referenceSourceType); + referenceSourceElements.add(referenceSourceElement); + setReferenceIdentifier(referenceSourceElement, referenceTargetIdentifier); + } + } + + protected void performRemoveOperation(ModelElementInstanceImpl referenceSourceParentElement, Object referenceTargetElement) { + Collection referenceSourceChildElements = referenceSourceParentElement.getChildElementsByType(referenceSourceType); + for (ModelElementInstance referenceSourceChildElement : referenceSourceChildElements) { + if (getReferenceTargetElement(referenceSourceChildElement).equals(referenceTargetElement)) { + referenceSourceParentElement.removeChildElement(referenceSourceChildElement); + } + } + } + + protected void performClearOperation(ModelElementInstanceImpl referenceSourceParentElement, Collection elementsToRemove) { + for (DomElement element: elementsToRemove) { + referenceSourceParentElement.getDomElement().removeChild(element); + } + } + + public String getReferenceIdentifier(ModelElementInstance referenceSourceElement) { + return referenceSourceElement.getTextContent(); + } + + @Override + protected void updateReference(ModelElementInstance referenceSourceElement, String oldIdentifier, String newIdentifier) { + String referencingTextContent = getReferenceIdentifier(referenceSourceElement); + if (oldIdentifier != null && oldIdentifier.equals(referencingTextContent)) { + setReferenceIdentifier(referenceSourceElement, newIdentifier); + } + } + + @Override + protected void removeReference(ModelElementInstance referenceSourceElement, ModelElementInstance referenceTargetElement) { + ModelElementInstance parentElement = referenceSourceElement.getParentElement(); + Collection childElementCollection = referenceSourceCollection.get(parentElement); + childElementCollection.remove(referenceSourceElement); + } + + public void setReferenceSourceElementType(ModelElementTypeImpl referenceSourceType) { + this.referenceSourceType = referenceSourceType; + } + + public ModelElementType getReferenceSourceElementType() { + return referenceSourceType; + } + + protected Collection getView(ModelElementInstanceImpl referenceSourceParentElement) { + DomDocument document = referenceSourceParentElement.getModelInstance().getDocument(); + Collection referenceSourceElements = referenceSourceCollection.get(referenceSourceParentElement); + Collection referenceTargetElements = new ArrayList(); + for (Source referenceSourceElement : referenceSourceElements) { + String identifier = getReferenceIdentifier(referenceSourceElement); + DomElement referenceTargetElement = document.getElementById(identifier); + if (referenceTargetElement != null) { + referenceTargetElements.add(referenceTargetElement); + } + else { + throw new ModelException("Unable to find a model element instance for id " + identifier); + } + } + return referenceTargetElements; + } + + public Collection getReferenceTargetElements(final ModelElementInstanceImpl referenceSourceParentElement) { + + return new Collection() { + + public int size() { + return getView(referenceSourceParentElement).size(); + } + + public boolean isEmpty() { + return getView(referenceSourceParentElement).isEmpty(); + } + + public boolean contains(Object o) { + if (o == null) { + return false; + } + else if (!(o instanceof ModelElementInstanceImpl)) { + return false; + } + else { + return getView(referenceSourceParentElement).contains(((ModelElementInstanceImpl)o).getDomElement()); + } + } + + public Iterator iterator() { + Collection modelElementCollection = ModelUtil.getModelElementCollection(getView(referenceSourceParentElement), referenceSourceParentElement.getModelInstance()); + return modelElementCollection.iterator(); + } + + public Object[] toArray() { + Collection modelElementCollection = ModelUtil.getModelElementCollection(getView(referenceSourceParentElement), referenceSourceParentElement.getModelInstance()); + return modelElementCollection.toArray(); + } + + public T1[] toArray(T1[] a) { + Collection modelElementCollection = ModelUtil.getModelElementCollection(getView(referenceSourceParentElement), referenceSourceParentElement.getModelInstance()); + return modelElementCollection.toArray(a); + } + + public boolean add(Target t) { + if (referenceSourceCollection.isImmutable()) { + throw new UnsupportedModelOperationException("add()", "collection is immutable"); + } + else { + if (!contains(t)) { + performAddOperation(referenceSourceParentElement, t); + } + return true; + } + } + + public boolean remove(Object o) { + if (referenceSourceCollection.isImmutable()) { + throw new UnsupportedModelOperationException("remove()", "collection is immutable"); + } + else { + ModelUtil.ensureInstanceOf(o, ModelElementInstanceImpl.class); + performRemoveOperation(referenceSourceParentElement, o); + return true; + } + } + + public boolean containsAll(Collection c) { + Collection modelElementCollection = ModelUtil.getModelElementCollection(getView(referenceSourceParentElement), referenceSourceParentElement.getModelInstance()); + return modelElementCollection.containsAll(c); + } + + public boolean addAll(Collection c) { + if (referenceSourceCollection.isImmutable()) { + throw new UnsupportedModelOperationException("addAll()", "collection is immutable"); + } + else { + boolean result = false; + for (Target o: c) { + result |= add(o); + } + return result; + } + + } + + public boolean removeAll(Collection c) { + if (referenceSourceCollection.isImmutable()) { + throw new UnsupportedModelOperationException("removeAll()", "collection is immutable"); + } + else { + boolean result = false; + for (Object o: c) { + result |= remove(o); + } + return result; + } + } + + public boolean retainAll(Collection c) { + throw new UnsupportedModelOperationException("retainAll()", "not implemented"); + } + + public void clear() { + if (referenceSourceCollection.isImmutable()) { + throw new UnsupportedModelOperationException("clear()", "collection is immutable"); + } + else { + Collection view = new ArrayList(); + for (Source referenceSourceElement : referenceSourceCollection.get(referenceSourceParentElement)) { + view.add(referenceSourceElement.getDomElement()); + } + performClearOperation(referenceSourceParentElement, view); + } + } + }; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ElementReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ElementReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..5e154d527bb71b584e1c40815e97ab2970a61235 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ElementReferenceImpl.java @@ -0,0 +1,86 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.ModelReferenceException; +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.reference.ElementReference; + +/** + * @author Sebastian Menski + */ +public class ElementReferenceImpl extends ElementReferenceCollectionImpl implements ElementReference { + + + public ElementReferenceImpl(ChildElement referenceSourceCollection) { + super(referenceSourceCollection); + } + + private ChildElement getReferenceSourceChild() { + return (ChildElement) getReferenceSourceCollection(); + } + + public Source getReferenceSource(ModelElementInstance referenceSourceParent) { + return getReferenceSourceChild().getChild(referenceSourceParent); + } + + private void setReferenceSource(ModelElementInstance referenceSourceParent, Source referenceSource) { + getReferenceSourceChild().setChild(referenceSourceParent, referenceSource); + } + + @SuppressWarnings("unchecked") + public Target getReferenceTargetElement(ModelElementInstanceImpl referenceSourceParentElement) { + Source referenceSource = getReferenceSource(referenceSourceParentElement); + if (referenceSource != null) { + String identifier = getReferenceIdentifier(referenceSource); + ModelElementInstance referenceTargetElement = referenceSourceParentElement.getModelInstance().getModelElementById(identifier); + if (referenceTargetElement != null) { + return (Target) referenceTargetElement; + } + else { + throw new ModelException("Unable to find a model element instance for id " + identifier); + } + } + else { + return null; + } + } + + public void setReferenceTargetElement(ModelElementInstanceImpl referenceSourceParentElement, Target referenceTargetElement) { + ModelInstanceImpl modelInstance = referenceSourceParentElement.getModelInstance(); + String identifier = referenceTargetAttribute.getValue(referenceTargetElement); + ModelElementInstance existingElement = modelInstance.getModelElementById(identifier); + + if (existingElement == null || !existingElement.equals(referenceTargetElement)) { + throw new ModelReferenceException("Cannot create reference to model element " + referenceTargetElement + +": element is not part of model. Please connect element to the model first."); + } + else { + Source referenceSourceElement = modelInstance.newInstance(getReferenceSourceElementType()); + setReferenceSource(referenceSourceParentElement, referenceSourceElement); + setReferenceIdentifier(referenceSourceElement, identifier); + } + } + + public void clearReferenceTargetElement(ModelElementInstanceImpl referenceSourceParentElement) { + getReferenceSourceChild().removeChild(referenceSourceParentElement); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/IdsElementReferenceCollectionBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/IdsElementReferenceCollectionBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..ee6b85b655a0c1bd9993089b699da52efa663f5f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/IdsElementReferenceCollectionBuilderImpl.java @@ -0,0 +1,32 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.impl.type.child.ChildElementCollectionImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * @author Sebastian Menski + */ +public class IdsElementReferenceCollectionBuilderImpl extends ElementReferenceCollectionBuilderImpl { + + public IdsElementReferenceCollectionBuilderImpl(Class childElementType, Class referenceTargetClass, ChildElementCollectionImpl collection) { + super(childElementType, referenceTargetClass, collection); + this.elementReferenceCollectionImpl = new IdsElementReferenceCollectionImpl(collection); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/IdsElementReferenceCollectionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/IdsElementReferenceCollectionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0e1c7c94bb12d75dbc870be0835871f69755ed06 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/IdsElementReferenceCollectionImpl.java @@ -0,0 +1,98 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.util.StringUtil; +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.camunda.bpm.model.xml.instance.DomElement; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; + +public class IdsElementReferenceCollectionImpl extends ElementReferenceCollectionImpl { + + protected String separator = " "; + + public IdsElementReferenceCollectionImpl(ChildElementCollection referenceSourceCollection) { + super(referenceSourceCollection); + } + + protected List getReferenceIdentifiers(ModelElementInstance referenceSourceElement) { + String referenceIdentifiers = getReferenceIdentifier(referenceSourceElement); + return StringUtil.splitListBySeparator(referenceIdentifiers, separator); + } + + protected void setReferenceIdentifiers(ModelElementInstance referenceSourceElement, List referenceIdentifiers) { + String referenceIdentifier = StringUtil.joinList(referenceIdentifiers, separator); + referenceSourceElement.setTextContent(referenceIdentifier); + } + + @Override + protected Collection getView(ModelElementInstanceImpl referenceSourceParentElement) { + DomDocument document = referenceSourceParentElement.getModelInstance().getDocument(); + Collection referenceSourceElements = getReferenceSourceCollection().get(referenceSourceParentElement); + Collection referenceTargetElements = new ArrayList(); + for (Source referenceSourceElement : referenceSourceElements) { + List identifiers = getReferenceIdentifiers(referenceSourceElement); + for (String identifier : identifiers) { + DomElement referenceTargetElement = document.getElementById(identifier); + if (referenceTargetElement != null) { + referenceTargetElements.add(referenceTargetElement); + } + else { + throw new ModelException("Unable to find a model element instance for id " + identifier); + } + } + } + return referenceTargetElements; + } + + @Override + protected void updateReference(ModelElementInstance referenceSourceElement, String oldIdentifier, String newIdentifier) { + List referenceIdentifiers = getReferenceIdentifiers(referenceSourceElement); + if (referenceIdentifiers.contains(oldIdentifier)) { + int index = referenceIdentifiers.indexOf(oldIdentifier); + referenceIdentifiers.remove(oldIdentifier); + referenceIdentifiers.add(index, newIdentifier); + setReferenceIdentifiers(referenceSourceElement, referenceIdentifiers); + } + } + + @Override + public void referencedElementRemoved(ModelElementInstance referenceTargetElement, Object referenceIdentifier) { + for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) { + List referenceIdentifiers = getReferenceIdentifiers(referenceSourceElement); + if (referenceIdentifiers.contains(referenceIdentifier)) { + if (referenceIdentifiers.size() == 1) { + // remove whole element + removeReference(referenceSourceElement, referenceTargetElement); + } + else { + // remove only single identifier + referenceIdentifiers.remove(referenceIdentifier); + setReferenceIdentifiers(referenceSourceElement, referenceIdentifiers); + } + } + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameAttributeReferenceBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameAttributeReferenceBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..59a48f407917c4f07d71a0d615bd28a83f6155f5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameAttributeReferenceBuilderImpl.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * @author Sebastian Menski + */ +public class QNameAttributeReferenceBuilderImpl extends AttributeReferenceBuilderImpl { + + /** + * Create a new {@link AttributeReferenceBuilderImpl} from the reference source attribute + * to the reference target model element instance + * + * @param referenceSourceAttribute the reference source attribute + * @param referenceTargetElement the reference target model element instance + */ + public QNameAttributeReferenceBuilderImpl(AttributeImpl referenceSourceAttribute, Class referenceTargetElement) { + super(referenceSourceAttribute, referenceTargetElement); + this.attributeReferenceImpl = new QNameAttributeReferenceImpl(referenceSourceAttribute); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameAttributeReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameAttributeReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..66ead77b60da76c3078fd76ec688b066eaa85c4e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameAttributeReferenceImpl.java @@ -0,0 +1,50 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl; +import org.camunda.bpm.model.xml.impl.util.QName; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * @author Sebastian Menski + * + */ +public class QNameAttributeReferenceImpl extends AttributeReferenceImpl { + + /** + * Create a new QName reference outgoing from the reference source attribute + * + * @param referenceSourceAttribute the reference source attribute + */ + public QNameAttributeReferenceImpl(AttributeImpl referenceSourceAttribute) { + super(referenceSourceAttribute); + } + + @Override + public String getReferenceIdentifier(ModelElementInstance referenceSourceElement) { + String identifier = super.getReferenceIdentifier(referenceSourceElement); + if (identifier != null) { + QName qName = QName.parseQName(identifier); + return qName.getLocalName(); + } + else { + return null; + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameElementReferenceBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameElementReferenceBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..cfbd1894cad36dcd9038a052441172718369c685 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameElementReferenceBuilderImpl.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.impl.type.child.ChildElementImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * @author Sebastian Menski + */ +public class QNameElementReferenceBuilderImpl extends ElementReferenceBuilderImpl { + + public QNameElementReferenceBuilderImpl(Class childElementType, Class referenceTargetClass, ChildElementImpl child) { + super(childElementType, referenceTargetClass, child); + this.elementReferenceCollectionImpl = new QNameElementReferenceImpl(child); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameElementReferenceCollectionBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameElementReferenceCollectionBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..cb51df855cb81e62b54411e6ba98d42b04b3d62d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameElementReferenceCollectionBuilderImpl.java @@ -0,0 +1,32 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.impl.type.child.ChildElementCollectionImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * @author Sebastian Menski + */ +public class QNameElementReferenceCollectionBuilderImpl extends ElementReferenceCollectionBuilderImpl { + + public QNameElementReferenceCollectionBuilderImpl(Class childElementType, Class referenceTargetClass, ChildElementCollectionImpl collection) { + super(childElementType, referenceTargetClass, collection); + this.elementReferenceCollectionImpl = new QNameElementReferenceCollectionImpl(collection); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameElementReferenceCollectionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameElementReferenceCollectionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..341a6bf6ac585463071eb43fd275b5d3a1421a34 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameElementReferenceCollectionImpl.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.impl.util.QName; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; + +/** + * @author Sebastian Menski + */ +public class QNameElementReferenceCollectionImpl extends ElementReferenceCollectionImpl { + + public QNameElementReferenceCollectionImpl(ChildElementCollection referenceSourceCollection) { + super(referenceSourceCollection); + } + + @Override + public String getReferenceIdentifier(ModelElementInstance referenceSourceElement) { + String identifier = super.getReferenceIdentifier(referenceSourceElement); + if (identifier != null) { + QName qName = QName.parseQName(identifier); + return qName.getLocalName(); + } + else { + return null; + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameElementReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameElementReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..3c3b71749d1175ad67919abd9399af2f51bcc3dc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/QNameElementReferenceImpl.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.impl.util.QName; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.child.ChildElement; + +/** + * @author Sebastian Menski + */ +public class QNameElementReferenceImpl extends ElementReferenceImpl { + + public QNameElementReferenceImpl(ChildElement referenceSourceCollection) { + super(referenceSourceCollection); + } + + @Override + public String getReferenceIdentifier(ModelElementInstance referenceSourceElement) { + String identifier = super.getReferenceIdentifier(referenceSourceElement); + if (identifier != null) { + QName qName = QName.parseQName(identifier); + return qName.getLocalName(); + } + else { + return null; + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..f01d8b1bbaa9d979383c04f94cce2c10ff6ed992 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java @@ -0,0 +1,175 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import java.util.Collection; +import java.util.Collections; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.ModelReferenceException; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.reference.Reference; + +/** + * @author Sebastian Menski + * + */ +public abstract class ReferenceImpl implements Reference { + + protected AttributeImpl referenceTargetAttribute; + + /** the actual type, may be different (a subtype of) {@link AttributeImpl#getOwningElementType()} */ + private ModelElementTypeImpl referenceTargetElementType; + + + /** + * Set the reference identifier in the reference source + * + * @param referenceSourceElement the reference source model element instance + * @param referenceIdentifier the new reference identifier + */ + protected abstract void setReferenceIdentifier(ModelElementInstance referenceSourceElement, String referenceIdentifier); + + /** + * Get the reference target model element instance + * + * @param referenceSourceElement the reference source model element instance + * @return the reference target model element instance or null if not set + */ + @SuppressWarnings("unchecked") + public T getReferenceTargetElement(ModelElementInstance referenceSourceElement) { + String identifier = getReferenceIdentifier(referenceSourceElement); + ModelElementInstance referenceTargetElement = referenceSourceElement.getModelInstance().getModelElementById(identifier); + if (referenceTargetElement != null) { + try { + return (T) referenceTargetElement; + + } catch(ClassCastException e) { + throw new ModelReferenceException("Element " + referenceSourceElement + " references element " + referenceTargetElement + " of wrong type. " + + "Expecting " + referenceTargetAttribute.getOwningElementType() + " got " + referenceTargetElement.getElementType()); + } + } + else { + return null; + } + } + + /** + * Set the reference target model element instance + * + * @param referenceSourceElement the reference source model element instance + * @param referenceTargetElement the reference target model element instance + * @throws ModelReferenceException if element is not already added to the model + */ + public void setReferenceTargetElement(ModelElementInstance referenceSourceElement, T referenceTargetElement) { + ModelInstance modelInstance = referenceSourceElement.getModelInstance(); + String referenceTargetIdentifier = referenceTargetAttribute.getValue(referenceTargetElement); + ModelElementInstance existingElement = modelInstance.getModelElementById(referenceTargetIdentifier); + + if(existingElement == null || !existingElement.equals(referenceTargetElement)) { + throw new ModelReferenceException("Cannot create reference to model element " + referenceTargetElement + +": element is not part of model. Please connect element to the model first."); + } else { + setReferenceIdentifier(referenceSourceElement, referenceTargetIdentifier); + } + } + + /** + * Set the reference target attribute + * + * @param referenceTargetAttribute the reference target string attribute + */ + public void setReferenceTargetAttribute(AttributeImpl referenceTargetAttribute) { + this.referenceTargetAttribute = referenceTargetAttribute; + } + + /** + * Get the reference target attribute + * + * @return the reference target string attribute + */ + public Attribute getReferenceTargetAttribute() { + return referenceTargetAttribute; + } + + /** + * Set the reference target model element type + * + * @param referenceTargetElementType the referenceTargetElementType to set + */ + public void setReferenceTargetElementType(ModelElementTypeImpl referenceTargetElementType) { + this.referenceTargetElementType = referenceTargetElementType; + } + + public Collection findReferenceSourceElements(ModelElementInstance referenceTargetElement) { + if(referenceTargetElementType.isBaseTypeOf(referenceTargetElement.getElementType())) { + ModelElementType owningElementType = getReferenceSourceElementType(); + return referenceTargetElement.getModelInstance().getModelElementsByType(owningElementType); + } + else { + return Collections.emptyList(); + } + } + + /** + * Update the reference identifier of the reference source model element instance + * + * @param referenceSourceElement the reference source model element instance + * @param oldIdentifier the old reference identifier + * @param newIdentifier the new reference identifier + */ + protected abstract void updateReference(ModelElementInstance referenceSourceElement, String oldIdentifier, String newIdentifier); + + /** + * Update the reference identifier + * + * @param referenceTargetElement the reference target model element instance + * @param oldIdentifier the old reference identifier + * @param newIdentifier the new reference identifier + */ + public void referencedElementUpdated(ModelElementInstance referenceTargetElement, String oldIdentifier, String newIdentifier) { + for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) { + updateReference(referenceSourceElement, oldIdentifier, newIdentifier); + } + } + + /** + * Remove the reference in the reference source model element instance + * + * @param referenceSourceElement the reference source model element instance + */ + protected abstract void removeReference(ModelElementInstance referenceSourceElement, ModelElementInstance referenceTargetElement); + + /** + * Remove the reference if the target element is removed + * + * @param referenceTargetElement the reference target model element instance, which is removed + * @param referenceIdentifier the identifier of the reference to filter reference source elements + */ + public void referencedElementRemoved(ModelElementInstance referenceTargetElement, Object referenceIdentifier) { + for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) { + if (referenceIdentifier.equals(getReferenceIdentifier(referenceSourceElement))) { + removeReference(referenceSourceElement, referenceTargetElement); + } + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/UriElementReferenceBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/UriElementReferenceBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..7ac78033bb3348399a44a7bef87647dcbe8fdf48 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/UriElementReferenceBuilderImpl.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.impl.type.child.ChildElementImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +public class UriElementReferenceBuilderImpl extends ElementReferenceBuilderImpl { + + public UriElementReferenceBuilderImpl(Class childElementType, Class referenceTargetClass, ChildElementImpl child) { + super(childElementType, referenceTargetClass, child); + this.elementReferenceCollectionImpl = new UriElementReferenceImpl(child); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/UriElementReferenceCollectionBuilderImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/UriElementReferenceCollectionBuilderImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..d99dfadb84d73bcae10046b13f0ade8675d06989 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/UriElementReferenceCollectionBuilderImpl.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.impl.type.child.ChildElementCollectionImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +public class UriElementReferenceCollectionBuilderImpl extends ElementReferenceCollectionBuilderImpl { + + public UriElementReferenceCollectionBuilderImpl(Class childElementType, Class referenceTargetClass, ChildElementCollectionImpl collection) { + super(childElementType, referenceTargetClass, collection); + this.elementReferenceCollectionImpl = new UriElementReferenceCollectionImpl(collection); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/UriElementReferenceCollectionImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/UriElementReferenceCollectionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..842cac8d066c77804c1aa48a13ac480d75ca985d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/UriElementReferenceCollectionImpl.java @@ -0,0 +1,52 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; + +public class UriElementReferenceCollectionImpl extends ElementReferenceCollectionImpl { + + public UriElementReferenceCollectionImpl(ChildElementCollection referenceSourceCollection) { + super(referenceSourceCollection); + } + + @Override + public String getReferenceIdentifier(ModelElementInstance referenceSourceElement) { + // TODO: implement something more robust (CAM-4028) + String identifier = referenceSourceElement.getAttributeValue("href"); + if (identifier != null) { + String[] parts = identifier.split("#"); + if (parts.length > 1) { + return parts[parts.length - 1]; + } + else { + return parts[0]; + } + } + else { + return null; + } + } + + @Override + protected void setReferenceIdentifier(ModelElementInstance referenceSourceElement, String referenceIdentifier) { + // TODO: implement something more robust (CAM-4028) + referenceSourceElement.setAttributeValue("href", "#" + referenceIdentifier); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/UriElementReferenceImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/UriElementReferenceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..2b6c26df2dabbd0598bb0392a93ce059a19d4223 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/UriElementReferenceImpl.java @@ -0,0 +1,52 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.type.reference; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.child.ChildElement; + +public class UriElementReferenceImpl extends ElementReferenceImpl { + + public UriElementReferenceImpl(ChildElement referenceSourceCollection) { + super(referenceSourceCollection); + } + + @Override + public String getReferenceIdentifier(ModelElementInstance referenceSourceElement) { + // TODO: implement something more robust (CAM-4028) + String identifier = referenceSourceElement.getAttributeValue("href"); + if (identifier != null) { + String[] parts = identifier.split("#"); + if (parts.length > 1) { + return parts[parts.length - 1]; + } + else { + return parts[0]; + } + } + else { + return null; + } + } + + @Override + protected void setReferenceIdentifier(ModelElementInstance referenceSourceElement, String referenceIdentifier) { + // TODO: implement something more robust (CAM-4028) + referenceSourceElement.setAttributeValue("href", "#" + referenceIdentifier); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/DomUtil.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/DomUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..c8ab3e0ac40bbdcadc38407baf91cd9b6bc272dc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/DomUtil.java @@ -0,0 +1,253 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.util; + +import org.camunda.bpm.model.xml.ModelParseException; +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.DomDocumentImpl; +import org.camunda.bpm.model.xml.impl.instance.DomElementImpl; +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.camunda.bpm.model.xml.instance.DomElement; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Logger; + +/** + * Helper methods which abstract some gruesome DOM specifics. + * It does not provide synchronization when invoked in parallel with + * the same objects. + * + * @author Daniel Meyer + * @author Sebastian Menski + * + */ +public final class DomUtil { + + /** + * A {@link NodeListFilter} allows to filter a {@link NodeList}, + * retaining only elements in the list which match the filter. + * + * @see DomUtil#filterNodeList(NodeList, NodeListFilter) + */ + public interface NodeListFilter { + + /** + * Test if node matches the filter + * + * @param node the node to match + * @return true if the filter does match the node, false otherwise + */ + boolean matches(Node node); + + } + + /** + * Filter retaining only Nodes of type {@link Node#ELEMENT_NODE} + * + */ + public static class ElementNodeListFilter implements NodeListFilter { + + public boolean matches(Node node) { + return node.getNodeType() == Node.ELEMENT_NODE; + } + + } + + /** + * Filters {@link Element Elements} by their nodeName + namespaceUri + * + */ + public static class ElementByNameListFilter extends ElementNodeListFilter { + + private final String localName; + private final String namespaceUri; + + /** + * @param localName the local name to filter for + * @param namespaceUri the namespaceUri to filter for + */ + public ElementByNameListFilter(String localName, String namespaceUri) { + this.localName = localName; + this.namespaceUri = namespaceUri; + } + + @Override + public boolean matches(Node node) { + return super.matches(node) + && localName.equals(node.getLocalName()) + && namespaceUri.equals(node.getNamespaceURI()); + } + + } + + public static class ElementByTypeListFilter extends ElementNodeListFilter { + + private final Class type; + private final ModelInstanceImpl model; + + public ElementByTypeListFilter(Class type, ModelInstanceImpl modelInstance) { + this.type = type; + this.model = modelInstance; + } + + @Override + public boolean matches(Node node) { + if (! super.matches(node)) { + return false; + } + ModelElementInstance modelElement = ModelUtil.getModelElement(new DomElementImpl((Element) node), model); + return type.isAssignableFrom(modelElement.getClass()); + } + } + + /** + * Allows to apply a {@link NodeListFilter} to a {@link NodeList}. This allows to remove all elements from a node list which do not match the Filter. + * + * @param nodeList the {@link NodeList} to filter + * @param filter the {@link NodeListFilter} to apply to the {@link NodeList} + * @return the List of all Nodes which match the filter + */ + public static List filterNodeList(NodeList nodeList, NodeListFilter filter) { + + List filteredList = new ArrayList(); + for(int i = 0; i< nodeList.getLength(); i++) { + Node node = nodeList.item(i); + if(filter.matches(node)) { + filteredList.add(new DomElementImpl((Element) node)); + } + } + + return filteredList; + + } + + /** + * Filters a {@link NodeList} retaining all elements + * + * @param nodeList the the {@link NodeList} to filter + * @return the list of all elements + */ + public static List filterNodeListForElements(NodeList nodeList) { + return filterNodeList(nodeList, new ElementNodeListFilter()); + } + + /** + * Filter a {@link NodeList} retaining all elements with a specific name + * + * + * @param nodeList the {@link NodeList} to filter + * @param namespaceUri the namespace for the elements + * @param localName the local element name to filter for + * @return the List of all Elements which match the filter + */ + public static List filterNodeListByName(NodeList nodeList, String namespaceUri, String localName) { + return filterNodeList(nodeList, new ElementByNameListFilter(localName, namespaceUri)); + } + + /** + * Filter a {@link NodeList} retaining all elements with a specific type + * + * + * @param nodeList the {@link NodeList} to filter + * @param modelInstance the model instance + * @param type the type class to filter for + * @return the list of all Elements which match the filter + */ + public static List filterNodeListByType(NodeList nodeList, ModelInstanceImpl modelInstance, Class type) { + return filterNodeList(nodeList, new ElementByTypeListFilter(type, modelInstance)); + } + + public static class DomErrorHandler implements ErrorHandler { + + private static final Logger LOGGER = Logger.getLogger(DomErrorHandler.class.getName()); + + private String getParseExceptionInfo(SAXParseException spe) { + return "URI=" + spe.getSystemId() + " Line=" + + spe.getLineNumber() + ": " + spe.getMessage(); + } + + public void warning(SAXParseException spe) { + LOGGER.warning(getParseExceptionInfo(spe)); + } + + public void error(SAXParseException spe) throws SAXException { + String message = "Error: " + getParseExceptionInfo(spe); + throw new SAXException(message); + } + + public void fatalError(SAXParseException spe) throws SAXException { + String message = "Fatal Error: " + getParseExceptionInfo(spe); + throw new SAXException(message); + } + } + + /** + * Get an empty DOM document + * + * @param documentBuilderFactory the factory to build to DOM document + * @return the new empty document + * @throws ModelParseException if unable to create a new document + */ + public static DomDocument getEmptyDocument(DocumentBuilderFactory documentBuilderFactory) { + try { + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + return new DomDocumentImpl(documentBuilder.newDocument()); + } catch (ParserConfigurationException e) { + throw new ModelParseException("Unable to create a new document", e); + } + } + + /** + * Create a new DOM document from the input stream + * + * @param documentBuilderFactory the factory to build to DOM document + * @param inputStream the input stream to parse + * @return the new DOM document + * @throws ModelParseException if a parsing or IO error is triggered + */ + public static DomDocument parseInputStream(DocumentBuilderFactory documentBuilderFactory, InputStream inputStream) { + + try { + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + documentBuilder.setErrorHandler(new DomErrorHandler()); + return new DomDocumentImpl(documentBuilder.parse(inputStream)); + } catch (ParserConfigurationException e) { + throw new ModelParseException("ParserConfigurationException while parsing input stream", e); + + } catch (SAXException e) { + throw new ModelParseException("SAXException while parsing input stream", e); + + } catch (IOException e) { + throw new ModelParseException("IOException while parsing input stream", e); + + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/IoUtil.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/IoUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..c0e3cbfca70a45f192e1c4e398095047026d2000 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/IoUtil.java @@ -0,0 +1,142 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.util; + +import org.camunda.bpm.model.xml.instance.DomDocument; + +import javax.xml.transform.*; +import javax.xml.transform.stream.StreamResult; +import java.io.*; + +/** + * @author Daniel Meyer + * @author Sebastian Menski + * + */ +public final class IoUtil { + + public static void closeSilently(Closeable closeable) { + try { + if (closeable != null) { + closeable.close(); + } + } catch (Exception e) { + // ignored + } + } + + /** + * Convert an {@link InputStream} to a {@link String} + * + * @param inputStream the {@link InputStream} to convert + * @return the resulting {@link String} + * @throws IOException + */ + public static String getStringFromInputStream(InputStream inputStream) throws IOException { + return getStringFromInputStream(inputStream, true); + } + + /** + * Convert an {@link InputStream} to a {@link String} + * + * @param inputStream the {@link InputStream} to convert + * @param trim trigger if whitespaces are trimmed in the output + * @return the resulting {@link String} + * @throws IOException + */ + private static String getStringFromInputStream(InputStream inputStream, boolean trim) throws IOException { + BufferedReader bufferedReader = null; + StringBuilder stringBuilder = new StringBuilder(); + try { + bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + String line; + while ((line = bufferedReader.readLine()) != null) { + if (trim) { + stringBuilder.append(line.trim()); + } + else { + stringBuilder.append(line).append("\n"); + } + } + } + finally { + closeSilently(bufferedReader); + } + + return stringBuilder.toString(); + } + + /** + * Converts a {@link OutputStream} to an {@link InputStream} by coping the data directly. + * WARNING: Do not use for large data (>100MB). Only for testing purpose. + * + * @param outputStream the {@link OutputStream} to convert + * @return the resulting {@link InputStream} + */ + public static InputStream convertOutputStreamToInputStream(OutputStream outputStream) { + byte[] data = ((ByteArrayOutputStream) outputStream).toByteArray(); + return new ByteArrayInputStream(data); + } + + /** + * Converts a {@link DomDocument} to its String representation + * + * @param document the XML document to convert + */ + public static String convertXmlDocumentToString(DomDocument document) { + StringWriter stringWriter = new StringWriter(); + StreamResult result = new StreamResult(stringWriter); + transformDocumentToXml(document, result); + return stringWriter.toString(); + } + + /** + * Writes a {@link DomDocument} to an {@link OutputStream} by transforming the DOM to XML. + * + * @param document the DOM document to write + * @param outputStream the {@link OutputStream} to write to + */ + public static void writeDocumentToOutputStream(DomDocument document, OutputStream outputStream) { + StreamResult result = new StreamResult(outputStream); + transformDocumentToXml(document, result); + } + + /** + * Transforms a {@link DomDocument} to XML output. + * + * @param document the DOM document to transform + * @param result the {@link StreamResult} to write to + */ + public static void transformDocumentToXml(DomDocument document, StreamResult result) { + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + try { + Transformer transformer = transformerFactory.newTransformer(); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); + + synchronized(document) { + transformer.transform(document.getDomSource(), result); + } + } catch (TransformerConfigurationException e) { + throw new ModelIoException("Unable to create a transformer for the model", e); + } catch (TransformerException e) { + throw new ModelIoException("Unable to transform model to xml", e); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelIoException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelIoException.java new file mode 100644 index 0000000000000000000000000000000000000000..681fe6a6f193e123ef589166aeeb6db3d39c5f41 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelIoException.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.util; + +/** + * An exception during IO operations. + * + * @author Sebastian Menski + */ +public class ModelIoException extends RuntimeException { + + public ModelIoException() { + } + + public ModelIoException(String message) { + super(message); + } + + public ModelIoException(String message, Throwable cause) { + super(message, cause); + } + + public ModelIoException(Throwable cause) { + super(cause); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelTypeException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelTypeException.java new file mode 100644 index 0000000000000000000000000000000000000000..10dd8bf2f5a92577cc2810ba4888b4740b925c5a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelTypeException.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.util; + +import org.camunda.bpm.model.xml.ModelException; + +import java.lang.reflect.Type; + +/** + *

Thrown in case a value cannot be converted to or from the requested type

+ * + * @author Daniel Meyer + * + */ +public class ModelTypeException extends ModelException { + + private static final long serialVersionUID = 1L; + + public ModelTypeException(String message) { + super(message); + } + + public ModelTypeException(String value, Type type) { + super("Illegal value "+value+" for type "+type); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..1cdfb5a86e8039cc0ff562b9f391903b4bb41c8f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java @@ -0,0 +1,271 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.util; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.impl.type.attribute.StringAttribute; +import org.camunda.bpm.model.xml.instance.DomElement; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.attribute.Attribute; + +import java.util.*; + +/** + * Some Helpers useful when handling model elements. + * + * @author Daniel Meyer + * + */ +public final class ModelUtil { + + private final static String ID_ATTRIBUTE_NAME = "id"; + + /** + * Returns the {@link ModelElementInstanceImpl ModelElement} for a DOM element. + * If the model element does not yet exist, it is created and linked to the DOM. + * + * @param domElement the child element to create a new {@link ModelElementInstanceImpl ModelElement} for + * @return the child model element + */ + public static ModelElementInstance getModelElement(DomElement domElement, ModelInstanceImpl modelInstance) { + ModelElementInstance modelElement = domElement.getModelElementInstance(); + if(modelElement == null) { + ModelElementTypeImpl modelType = getModelElement(domElement, modelInstance, domElement.getNamespaceURI()); + modelElement = modelType.newInstance(modelInstance, domElement); + domElement.setModelElementInstance(modelElement); + } + return modelElement; + } + + /** + * Returns the {@link ModelElementInstanceImpl ModelElement} for a DOM element. + * If the model element does not yet exist, it is created and linked to the DOM. + * + * @param domElement the child element to create a new {@link ModelElementInstanceImpl ModelElement} for + * @param modelInstance the {@link ModelInstanceImpl ModelInstance} for which the new {@link ModelElementInstanceImpl ModelElement} is created + * @param modelType the {@link ModelElementTypeImpl ModelElementType} to create a new {@link ModelElementInstanceImpl ModelElement} for + * @return the child model element + */ + public static ModelElementInstance getModelElement(DomElement domElement, ModelInstanceImpl modelInstance, ModelElementTypeImpl modelType) { + ModelElementInstance modelElement = domElement.getModelElementInstance(); + + if(modelElement == null) { + modelElement = modelType.newInstance(modelInstance, domElement); + domElement.setModelElementInstance(modelElement); + } + return modelElement; + } + + protected static ModelElementTypeImpl getModelElement(DomElement domElement, ModelInstanceImpl modelInstance, String namespaceUri) { + String localName = domElement.getLocalName(); + ModelElementTypeImpl modelType = (ModelElementTypeImpl) modelInstance.getModel().getTypeForName(namespaceUri, localName); + + if (modelType == null) { + + Model model = modelInstance.getModel(); + String actualNamespaceUri = model.getActualNamespace(namespaceUri); + + if (actualNamespaceUri != null) { + modelType = getModelElement(domElement, modelInstance, actualNamespaceUri); + } + else { + modelType = (ModelElementTypeImpl) modelInstance.registerGenericType(namespaceUri, localName); + } + + } + return modelType; + } + + public static QName getQName(String namespaceUri, String localName) { + return new QName(namespaceUri, localName); + } + + public static void ensureInstanceOf(Object instance, Class type) { + if(!type.isAssignableFrom(instance.getClass())) { + throw new ModelException("Object is not instance of type "+type.getName()); + } + } + + // String to primitive type converters //////////////////////////////////// + + public static boolean valueAsBoolean(String rawValue) { + return Boolean.parseBoolean(rawValue); + } + + public static int valueAsInteger(String rawValue) { + try { + return Integer.parseInt(rawValue); + } catch(NumberFormatException e) { + throw new ModelTypeException(rawValue, Integer.class); + } + } + + public static float valueAsFloat(String rawValue) { + try { + return Float.parseFloat(rawValue); + }catch(NumberFormatException e) { + throw new ModelTypeException(rawValue, Float.class); + } + } + + public static double valueAsDouble(String rawValue) { + try { + return Double.parseDouble(rawValue); + }catch(NumberFormatException e) { + throw new ModelTypeException(rawValue, Double.class); + } + } + + public static short valueAsShort(String rawValue) { + try { + return Short.parseShort(rawValue); + }catch(NumberFormatException e) { + throw new ModelTypeException(rawValue, Short.class); + } + } + + // primitive type to string converters ////////////////////////////////////// + + public static String valueAsString(boolean booleanValue) { + return Boolean.toString(booleanValue); + } + + public static String valueAsString(int integerValue) { + return Integer.toString(integerValue); + } + + public static String valueAsString(float floatValue) { + return Float.toString(floatValue); + } + + public static String valueAsString(double doubleValue) { + return Double.toString(doubleValue); + } + + public static String valueAsString(short shortValue) { + return Short.toString(shortValue); + } + + /** + * Get a collection of all model element instances in a view + * + * @param view the collection of DOM elements to find the model element instances for + * @param model the model of the elements + * @return the collection of model element instances of the view + */ + @SuppressWarnings("unchecked") + public static Collection getModelElementCollection(Collection view, ModelInstanceImpl model) { + List resultList = new ArrayList(); + for (DomElement element : view) { + resultList.add(getModelElement(element, model)); + } + return (Collection) resultList; + } + + /** + * Find the index of the type of a model element in a list of element types + * + * @param modelElement the model element which type is searched for + * @param childElementTypes the list to search the type + * @return the index of the model element type in the list or -1 if it is not found + */ + public static int getIndexOfElementType(ModelElementInstance modelElement, List childElementTypes) { + for (int index = 0; index < childElementTypes.size(); index++) { + ModelElementType childElementType = childElementTypes.get(index); + Class instanceType = childElementType.getInstanceType(); + if(instanceType.isAssignableFrom(modelElement.getClass())) { + return index; + } + } + Collection childElementTypeNames = new ArrayList(); + for (ModelElementType childElementType : childElementTypes) { + childElementTypeNames.add(childElementType.getTypeName()); + } + throw new ModelException("New child is not a valid child element type: " + modelElement.getElementType().getTypeName() + "; valid types are: " + childElementTypeNames); + } + + /** + * Calculate a collection of all extending types for the given base types + * + * @param baseTypes the collection of types to calculate the union of all extending types + */ + public static Collection calculateAllExtendingTypes(Model model, Collection baseTypes) { + Set allExtendingTypes = new HashSet(); + for (ModelElementType baseType : baseTypes) { + ModelElementTypeImpl modelElementTypeImpl = (ModelElementTypeImpl) model.getType(baseType.getInstanceType()); + modelElementTypeImpl.resolveExtendingTypes(allExtendingTypes); + } + return allExtendingTypes; + } + + /** + * Calculate a collection of all base types for the given type + */ + public static Collection calculateAllBaseTypes(ModelElementType type) { + List baseTypes = new ArrayList(); + ModelElementTypeImpl typeImpl = (ModelElementTypeImpl) type; + typeImpl.resolveBaseTypes(baseTypes); + return baseTypes; + } + + /** + * Set new identifier if the type has a String id attribute + * + * @param type the type of the model element + * @param modelElementInstance the model element instance to set the id + * @param newId new identifier + * @param withReferenceUpdate true to update id references in other elements, false otherwise + */ + public static void setNewIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, + String newId, boolean withReferenceUpdate) { + Attribute id = type.getAttribute(ID_ATTRIBUTE_NAME); + if (id != null && id instanceof StringAttribute && id.isIdAttribute()) { + ((StringAttribute) id).setValue(modelElementInstance, newId, withReferenceUpdate); + } + } + + /** + * Set unique identifier if the type has a String id attribute + * + * @param type the type of the model element + * @param modelElementInstance the model element instance to set the id + */ + public static void setGeneratedUniqueIdentifier(ModelElementType type, ModelElementInstance modelElementInstance) { + setGeneratedUniqueIdentifier(type, modelElementInstance, true); + } + + /** + * Set unique identifier if the type has a String id attribute + * + * @param type the type of the model element + * @param modelElementInstance the model element instance to set the id + * @param withReferenceUpdate true to update id references in other elements, false otherwise + */ + public static void setGeneratedUniqueIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, boolean withReferenceUpdate) { + setNewIdentifier(type, modelElementInstance, ModelUtil.getUniqueIdentifier(type), withReferenceUpdate); + } + + public static String getUniqueIdentifier(ModelElementType type) { + return type.getTypeName() + "_" + UUID.randomUUID(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/QName.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/QName.java new file mode 100644 index 0000000000000000000000000000000000000000..534095c69adf14af3640299c5decd47ac3c0dff8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/QName.java @@ -0,0 +1,114 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.util; + +/** + * @author Daniel Meyer + * + */ +public class QName { + + private final String qualifier; + private final String localName; + + public QName(String localName) { + this(null, localName); + } + + public QName(String qualifier, String localName) { + this.localName = localName; + this.qualifier = qualifier; + } + + public String getQualifier() { + return qualifier; + } + + public String getLocalName() { + return localName; + } + + public static QName parseQName(String identifier) { + String qualifier; + String localName; + + String[] split = identifier.split(":", 2); + if(split.length == 2) { + qualifier = split[0]; + localName = split[1]; + } else { + qualifier = null; + localName = split[0]; + } + + return new QName(qualifier, localName); + } + + @Override + public String toString() { + return combine(qualifier, localName); + } + + public static String combine(String qualifier, String localName) { + if (qualifier == null || qualifier.isEmpty()) { + return localName; + } + else { + return qualifier + ":" + localName; + } + } + + @Override + public int hashCode() { + int prime = 31; + int result = 1; + result = prime * result + ((localName == null) ? 0 : localName.hashCode()); + result = prime * result + ((qualifier == null) ? 0 : qualifier.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + QName other = (QName) obj; + if (localName == null) { + if (other.localName != null) { + return false; + } + } else if (!localName.equals(other.localName)) { + return false; + } + if (qualifier == null) { + if (other.qualifier != null) { + return false; + } + } else if (!qualifier.equals(other.qualifier)) { + return false; + } + return true; + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/ReflectUtil.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/ReflectUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..1eb2321042ea6faab6ce25a3d55fc5d5420e5360 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/ReflectUtil.java @@ -0,0 +1,100 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.util; + +import org.camunda.bpm.model.xml.ModelException; + +import java.io.File; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.net.URISyntaxException; +import java.net.URL; + + +/** + * @author Tom Baeyens + */ +public abstract class ReflectUtil { + + public static InputStream getResourceAsStream(String name) { + // Try the current Thread context class loader + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + InputStream resourceStream = classLoader.getResourceAsStream(name); + if (resourceStream == null) { + // Finally, try the class loader for this class + classLoader = ReflectUtil.class.getClassLoader(); + resourceStream = classLoader.getResourceAsStream(name); + } + + return resourceStream; + } + + public static URL getResource(String name) { + return getResource(name, null); + } + + public static URL getResource(String name, ClassLoader classLoader) { + if(classLoader == null) { + // Try the current Thread context class loader + classLoader = Thread.currentThread().getContextClassLoader(); + } + URL url = classLoader.getResource(name); + if (url == null) { + // Finally, try the class loader for this class + classLoader = ReflectUtil.class.getClassLoader(); + url = classLoader.getResource(name); + } + + return url; + } + + public static File getResourceAsFile(String path) { + URL resource = getResource(path); + try { + return new File(resource.toURI()); + } catch (URISyntaxException e) { + throw new ModelException("Exception while loading resource file " + path, e); + } + } + + /** + * Create a new instance of the provided type + * + * @param type the class to create a new instance of + * @param parameters the parameters to pass to the constructor + * @return the created instance + */ + public static T createInstance(Class type, Object... parameters) { + + // get types for parameters + Class[] parameterTypes = new Class[parameters.length]; + for (int i = 0; i < parameters.length; i++) { + Object parameter = parameters[i]; + parameterTypes[i] = parameter.getClass(); + } + + try { + // create instance + Constructor constructor = type.getConstructor(parameterTypes); + return constructor.newInstance(parameters); + + } catch (Exception e) { + throw new ModelException("Exception while creating an instance of type "+type, e); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/StringUtil.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/StringUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..393b735049b3b2ee48b103c0aefd362a1fde7c3c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/StringUtil.java @@ -0,0 +1,92 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.util; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author Sebastian Menski + */ +public final class StringUtil { + + private static final Pattern pattern = Pattern.compile("(\\w[^,]*)|([#$]\\{[^}]*})"); + + /** + * Splits a comma separated list in to single Strings. The list can + * contain expressions with commas in it. + * + * @param text the comma separated list + * @return the Strings of the list or an empty List if text is empty or null + */ + public static List splitCommaSeparatedList(String text) { + if (text == null || text.isEmpty()) { + return Collections.emptyList(); + } + Matcher matcher = pattern.matcher(text); + List parts = new ArrayList(); + while(matcher.find()) { + parts.add(matcher.group().trim()); + } + return parts; + } + + /** + * Joins a list of Strings to a comma separated single String. + * + * @param list the list to join + * @return the resulting comma separated string or null if the list is null + */ + public static String joinCommaSeparatedList(List list) { + return joinList(list, ", "); + } + + public static List splitListBySeparator(String text, String separator) { + String[] result = new String[]{}; + if (text != null) { + result = text.split(separator); + } + return new ArrayList(Arrays.asList(result)); + } + + public static String joinList(List list, String separator) { + if (list == null) { + return null; + } + + int size = list.size(); + if (size == 0) { + return ""; + } + else if (size == 1) { + return list.get(0); + } + else { + StringBuilder builder = new StringBuilder(size * 8); + builder.append(list.get(0)); + for (Object element : list.subList(1, size)) { + builder.append(separator); + builder.append(element); + } + return builder.toString(); + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/WrongDocumentException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/WrongDocumentException.java new file mode 100644 index 0000000000000000000000000000000000000000..e7d4108a81b64ad8052837e0c04671ef9d4b50d3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/WrongDocumentException.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.util; + +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.w3c.dom.Node; + +/** + *

Thrown when a Model Element is added to the wrong document

+ * + * @author Daniel Meyer + * + */ +public class WrongDocumentException extends ModelException { + + private static final long serialVersionUID = 1L; + + public WrongDocumentException(Node nodeToAdd, DomDocument targetDocument) { + super("Cannot add attribute '"+ nodeToAdd +"' to document '" + targetDocument + "' not created by document."); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/XmlQName.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/XmlQName.java new file mode 100644 index 0000000000000000000000000000000000000000..30b53662e484e8e2c4e9eb48d8a09932897706eb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/util/XmlQName.java @@ -0,0 +1,151 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.util; + +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.camunda.bpm.model.xml.instance.DomElement; + +import java.util.HashMap; +import java.util.Map; + +import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI; + +/** + * @author Sebastian Menski + */ +public class XmlQName { + + public static final Map KNOWN_PREFIXES; + static + { + KNOWN_PREFIXES = new HashMap(); + KNOWN_PREFIXES.put("http://www.camunda.com/fox", "fox"); + KNOWN_PREFIXES.put("http://activiti.org/bpmn", "camunda"); + KNOWN_PREFIXES.put("http://camunda.org/schema/1.0/bpmn", "camunda"); + KNOWN_PREFIXES.put("http://www.omg.org/spec/BPMN/20100524/MODEL", "bpmn2"); + KNOWN_PREFIXES.put("http://www.omg.org/spec/BPMN/20100524/DI", "bpmndi"); + KNOWN_PREFIXES.put("http://www.omg.org/spec/DD/20100524/DI", "di"); + KNOWN_PREFIXES.put("http://www.omg.org/spec/DD/20100524/DC", "dc"); + KNOWN_PREFIXES.put(XMLNS_ATTRIBUTE_NS_URI, ""); + } + + protected DomElement rootElement; + protected DomElement element; + + protected String localName; + protected String namespaceUri; + protected String prefix; + + public XmlQName(DomDocument document, String namespaceUri, String localName) { + this(document, null, namespaceUri, localName); + } + + public XmlQName(DomElement element, String namespaceUri, String localName) { + this(element.getDocument(), element, namespaceUri, localName); + } + + public XmlQName(DomDocument document, DomElement element, String namespaceUri, String localName) { + this.rootElement = document.getRootElement(); + this.element = element; + this.localName = localName; + this.namespaceUri = namespaceUri; + this.prefix = null; + } + + public String getNamespaceUri() { + return namespaceUri; + } + + public String getLocalName() { + return localName; + } + + public String getPrefixedName() { + if (prefix == null) { + synchronized (this) { + if (prefix == null) { + this.prefix = determinePrefixAndNamespaceUri(); + } + } + } + return QName.combine(prefix, localName); + } + + public boolean hasLocalNamespace() { + if (element != null) { + return element.getNamespaceURI().equals(namespaceUri); + } + else { + return false; + } + } + + private String determinePrefixAndNamespaceUri() { + if (namespaceUri != null) { + if (rootElement != null && namespaceUri.equals(rootElement.getNamespaceURI())) { + // global namespaces do not have a prefix or namespace URI + return null; + } + else { + // lookup for prefix + String lookupPrefix = lookupPrefix(); + if (lookupPrefix == null && rootElement != null) { + // if no prefix is found we generate a new one + // search for known prefixes + String knownPrefix = KNOWN_PREFIXES.get(namespaceUri); + if (knownPrefix == null) { + // generate namespace + return rootElement.registerNamespace(namespaceUri); + } + else if (knownPrefix.isEmpty()) { + // ignored namespace + return null; + } + else { + // register known prefix + rootElement.registerNamespace(knownPrefix, namespaceUri); + return knownPrefix; + } + } + else { + return lookupPrefix; + } + } + } + else { + // no namespace so no prefix + return null; + } + } + + private String lookupPrefix() { + if (namespaceUri != null) { + String lookupPrefix = null; + if (element != null) { + lookupPrefix = element.lookupPrefix(namespaceUri); + } + else if (rootElement != null) { + lookupPrefix = rootElement.lookupPrefix(namespaceUri); + } + return lookupPrefix; + } + else { + return null; + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/validation/ModelInstanceValidator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/validation/ModelInstanceValidator.java new file mode 100644 index 0000000000000000000000000000000000000000..afa5100bc6b450af8129d43583bc9c517d8d5550 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/validation/ModelInstanceValidator.java @@ -0,0 +1,67 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.validation; + +import java.util.Collection; + +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.validation.ModelElementValidator; +import org.camunda.bpm.model.xml.validation.ValidationResults; + +/** + * @author Daniel Meyer + * + */ +public class ModelInstanceValidator { + + protected ModelInstanceImpl modelInstanceImpl; + protected Collection> validators; + + public ModelInstanceValidator(ModelInstanceImpl modelInstanceImpl, Collection> validators) { + this.modelInstanceImpl = modelInstanceImpl; + this.validators = validators; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + public ValidationResults validate() { + + ValidationResultsCollectorImpl resultsCollector = new ValidationResultsCollectorImpl(); + + for (ModelElementValidator validator : validators) { + + Class elementType = validator.getElementType(); + Collection modelElementsByType = modelInstanceImpl.getModelElementsByType(elementType); + + for (ModelElementInstance element : modelElementsByType) { + + resultsCollector.setCurrentElement(element); + + try { + validator.validate(element, resultsCollector); + } + catch(RuntimeException e) { + throw new RuntimeException("Validator " + validator + " threw an exception while validating "+element, e); + } + } + + } + + return resultsCollector.getResults(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/validation/ModelValidationResultImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/validation/ModelValidationResultImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..6fe1b97032cfdaa9567a6dbf981111debf1e5f79 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/validation/ModelValidationResultImpl.java @@ -0,0 +1,61 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.validation; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.validation.ValidationResult; +import org.camunda.bpm.model.xml.validation.ValidationResultType; + +/** + * @author Daniel Meyer + * + */ +public class ModelValidationResultImpl implements ValidationResult { + + protected int code; + protected ValidationResultType type; + protected ModelElementInstance element; + protected String message; + + public ModelValidationResultImpl(ModelElementInstance element, ValidationResultType type, int code, String message) { + this.element = element; + this.type = type; + this.code = code; + this.message = message; + } + + @Override + public ValidationResultType getType() { + return type; + } + + @Override + public ModelElementInstance getElement() { + return element; + } + + @Override + public String getMessage() { + return message; + } + + @Override + public int getCode() { + return code; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/validation/ModelValidationResultsImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/validation/ModelValidationResultsImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..689da935db65b788bbb9b524b9c972baa10030b6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/validation/ModelValidationResultsImpl.java @@ -0,0 +1,130 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.validation; + +import java.io.StringWriter; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.validation.ValidationResult; +import org.camunda.bpm.model.xml.validation.ValidationResultFormatter; +import org.camunda.bpm.model.xml.validation.ValidationResults; + +/** + * @author Daniel Meyer + */ +public class ModelValidationResultsImpl implements ValidationResults { + + protected Map> collectedResults; + + protected int errorCount; + protected int warningCount; + + public ModelValidationResultsImpl( + Map> collectedResults, + int errorCount, + int warningCount) { + this.collectedResults = collectedResults; + this.errorCount = errorCount; + this.warningCount = warningCount; + } + + public ModelValidationResultsImpl(ValidationResults... validationResults) { + collectedResults = new HashMap<>(); + for (var entry : validationResults) { + collectedResults.putAll(entry.getResults()); + errorCount += entry.getErrorCount(); + warningCount += entry.getWarinigCount(); + } + } + + @Override + public boolean hasErrors() { + return errorCount > 0; + } + + @Override + public int getErrorCount() { + return errorCount; + } + + @Override + public int getWarinigCount() { + return warningCount; + } + + @Override + public void write(StringWriter writer, ValidationResultFormatter formatter) { + for (Entry> entry : collectedResults.entrySet()) { + + ModelElementInstance element = entry.getKey(); + List results = entry.getValue(); + + formatter.formatElement(writer, element); + + for (ValidationResult result : results) { + formatter.formatResult(writer, result); + } + } + } + + @Override + public void write(StringWriter writer, ValidationResultFormatter formatter, int maxSize) { + int printedCount = 0; + int previousLength = 0; + for (var entry : collectedResults.entrySet()) { + var element = entry.getKey(); + var results = entry.getValue(); + + formatter.formatElement(writer, element); + + for (var result : results) { + formatter.formatResult(writer, result); + + // Size and Length are not necessarily the same, depending on the encoding of the string. + int currentSize = writer.getBuffer().toString().getBytes().length; + int currentLength = writer.getBuffer().length(); + if (!canAccommodateResult(maxSize, currentSize, printedCount, formatter)) { + writer.getBuffer().setLength(previousLength); + int remaining = errorCount + warningCount - printedCount; + formatter.formatSuffixWithOmittedResultsCount(writer, remaining); + return; + } + printedCount++; + previousLength = currentLength; + } + } + } + + private boolean canAccommodateResult( + int maxSize, int currentSize, int printedCount, ValidationResultFormatter formatter) { + boolean isLastItemToPrint = printedCount == errorCount + warningCount - 1; + if (isLastItemToPrint && currentSize <= maxSize) { + return true; + } + int remaining = errorCount + warningCount - printedCount; + int suffixLength = formatter.getFormattedSuffixWithOmittedResultsSize(remaining); + return currentSize + suffixLength <= maxSize; + } + + @Override + public Map> getResults() { + return collectedResults; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/validation/ValidationResultsCollectorImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/validation/ValidationResultsCollectorImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4b7db1b0649ce5f0ea1d0bdc8fb2dc8604565d74 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/impl/validation/ValidationResultsCollectorImpl.java @@ -0,0 +1,77 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.validation; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.validation.ValidationResult; +import org.camunda.bpm.model.xml.validation.ValidationResultType; +import org.camunda.bpm.model.xml.validation.ValidationResults; +import org.camunda.bpm.model.xml.validation.ValidationResultCollector; + +/** + * @author Daniel Meyer + * + */ +public class ValidationResultsCollectorImpl implements ValidationResultCollector { + + protected ModelElementInstance currentElement; + + protected Map> collectedResults = new HashMap>(); + + protected int errorCount = 0; + protected int warningCount = 0; + + @Override + public void addError(int code, String message) { + resultsForCurrentElement() + .add(new ModelValidationResultImpl(currentElement, ValidationResultType.ERROR, code, message)); + + ++errorCount; + } + + @Override + public void addWarning(int code, String message) { + resultsForCurrentElement() + .add(new ModelValidationResultImpl(currentElement, ValidationResultType.WARNING, code, message)); + + ++warningCount; + } + + public void setCurrentElement(ModelElementInstance currentElement) { + this.currentElement = currentElement; + } + + public ValidationResults getResults() { + return new ModelValidationResultsImpl(collectedResults, errorCount, warningCount); + } + + protected List resultsForCurrentElement() { + List resultsByElement = collectedResults.get(currentElement); + + if(resultsByElement == null) { + resultsByElement = new ArrayList(); + collectedResults.put(currentElement, resultsByElement); + } + return resultsByElement; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/instance/DomDocument.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/instance/DomDocument.java new file mode 100644 index 0000000000000000000000000000000000000000..e1e05017e95cf42dabe37c68f3fe6fdb0645bf92 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/instance/DomDocument.java @@ -0,0 +1,106 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.instance; + +import java.util.List; + +import javax.xml.transform.dom.DOMSource; + +import org.w3c.dom.Document; + +/** + * Encapsulates a {@link Document}. Implementations of this interface must be thread-safe. + * + * @author Sebastian Menski + */ +public interface DomDocument { + + /** + * Returns the root element of the document. + * + * @return the root element or null if non exists + */ + DomElement getRootElement(); + + /** + * Sets the root element of the DOM document. Replace an existing if necessary. + * + * @param rootElement the new root element + */ + void setRootElement(DomElement rootElement); + + /** + * Creates a new element in the dom document. + * + * @param namespaceUri the namespaceUri of the new element + * @param localName the localName of the new element + * @return the new DOM element + */ + DomElement createElement(String namespaceUri, String localName); + + /** + * Gets an element by its id. + * + * @param id the id to search for + * @return the element or null if no such element exists + */ + DomElement getElementById(String id); + + /** + * Gets all elements with the namespace and name. + * + * @param namespaceUri the element namespaceURI to search for + * @param localName the element name to search for + * @return the list of matching elements + */ + List getElementsByNameNs(String namespaceUri, String localName); + + /** + * Returns a new {@link DOMSource} of the document. + * + * Note that a {@link DOMSource} wraps the underlying {@link Document} which is + * not thread-safe. Multiple DOMSources of the same document should be synchronized + * by the calling application. + * + * @return the new {@link DOMSource} + */ + DOMSource getDomSource(); + + /** + * Registers a new namespace with a generic prefix. + * + * @param namespaceUri the namespaceUri of the new namespace + * @return the used prefix + */ + String registerNamespace(String namespaceUri); + + /** + * Registers a new namespace for the prefix. + * + * @param prefix the prefix of the new namespace + * @param namespaceUri the namespaceUri of the new namespace + */ + void registerNamespace(String prefix, String namespaceUri); + + /** + * Clones the DOM document. + * + * @return the cloned DOM document + */ + DomDocument clone(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/instance/DomElement.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/instance/DomElement.java new file mode 100644 index 0000000000000000000000000000000000000000..1d6a60367279d9a259033106c275346d8476d9fa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/instance/DomElement.java @@ -0,0 +1,278 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.instance; + +import java.util.List; +import java.util.Set; + +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.w3c.dom.Element; + +/** + * Encapsulates {@link Element}. Implementations of this interface must be thread-safe. + * + * @author Sebastian Menski + */ +public interface DomElement { + + /** + * Returns the namespace URI for this element. + * + * @return the namespace URI + */ + String getNamespaceURI(); + + /** + * Returns the local name of this element. + * + * @return the local name + */ + String getLocalName(); + + /** + * Returns the prefix of this element. + * + * @return the prefix + */ + String getPrefix(); + + /** + * Returns the DOM document which contains this element. + * + * @return the DOM document or null if the element itself is a document + */ + DomDocument getDocument(); + + /** + * Returns the root element of the document which contains this element. + * + * @return the root element of the document or null if non exists + */ + DomElement getRootElement(); + + /** + * Returns the parent element of this element. + * + * @return the parent element or null if not part of a tree + */ + DomElement getParentElement(); + + /** + * Returns all child elements of this element. + * + * @return the list of child elements + */ + List getChildElements(); + + /** + * Returns all child elements of this element with a specific namespace + name + * + * @return the list of child elements + */ + List getChildElementsByNameNs(String namespaceUris, String elementName); + + /** + * Returns all child elements of this element with specific namespaces + name. + * + * @return the list of child elements + */ + List getChildElementsByNameNs(Set namespaceUris, String elementName); + + /** + * Returns all child elements of this element with a specific type. + * + * @return the list of child elements matching the type + */ + List getChildElementsByType(ModelInstanceImpl modelInstance, Class elementType); + + /** + * Replaces a child element with a new element. + * + * @param newChildDomElement the new child element + * @param existingChildDomElement the existing child element + * @throws ModelException if the child cannot be replaced + */ + void replaceChild(DomElement newChildDomElement, DomElement existingChildDomElement); + + /** + * Removes a child element of this element. + * + * @param domElement the child element to remove + * @return true if the child element was removed otherwise false + */ + boolean removeChild(DomElement domElement); + + /** + * Appends the element to the child elements of this element. + * + * @param childElement the element to append + */ + void appendChild(DomElement childElement); + + /** + * Inserts the new child element after another child element. If the child element to + * insert after is null the new child element will be inserted at the beginning. + * + * @param elementToInsert the new element to insert + * @param insertAfter the existing child element to insert after or null + */ + void insertChildElementAfter(DomElement elementToInsert, DomElement insertAfter); + + /** + * Checks if this element has a attribute under the namespace of this element. + * + * @param localName the name of the attribute + * @return true if the attribute exists otherwise false + */ + boolean hasAttribute(String localName); + + /** + * Checks if this element has a attribute with the given namespace. + * + * @param namespaceUri the namespaceUri of the namespace + * @param localName the name of the attribute + * @return true if the attribute exists otherwise false + */ + boolean hasAttribute(String namespaceUri, String localName); + + /** + * Returns the attribute value for the namespace of this element. + * + * @param attributeName the name of the attribute + * @return the value of the attribute or the empty string + */ + String getAttribute(String attributeName); + + /** + * Returns the attribute value for the given namespace. + * + * @param namespaceUri the namespaceUri of the namespace + * @param localName the name of the attribute + * @return the value of the attribute or the empty string + */ + String getAttribute(String namespaceUri, String localName); + + /** + * Sets the attribute value for the namespace of this element. + * + * @param localName the name of the attribute + * @param value the value to set + */ + void setAttribute(String localName, String value); + + /** + * Sets the attribute value for the given namespace. + * + * @param namespaceUri the namespaceUri of the namespace + * @param localName the name of the attribute + * @param value the value to set + */ + void setAttribute(String namespaceUri, String localName, String value); + + /** + * Sets the value of a id attribute for the namespace of this element. + * + * @param localName the name of the attribute + * @param value the value to set + */ + void setIdAttribute(String localName, String value); + + /** + * Sets the value of a id attribute for the given namespace. + * + * @param namespaceUri the namespaceUri of the namespace + * @param localName the name of the attribute + * @param value the value to set + */ + void setIdAttribute(String namespaceUri, String localName, String value); + + /** + * Removes the attribute for the namespace of this element. + * + * @param localName the name of the attribute + */ + void removeAttribute(String localName); + + /** + * Removes the attribute for the given namespace. + * + * @param namespaceUri the namespaceUri of the namespace + * @param localName the name of the attribute + */ + void removeAttribute(String namespaceUri, String localName); + + /** + * Gets the text content of this element all its descendants. + * + * @return the text content + */ + String getTextContent(); + + /** + * Sets the text content of this element. + * + * @param textContent the text content to set + */ + void setTextContent(String textContent); + + /** + * Adds a CDATA section to this element. + * + * @param textContent the CDATA content to set + */ + void addCDataSection(String data); + + /** + * Returns the {@link ModelElementInstance} which is associated with this element. + * + * @return the {@link ModelElementInstance} or null if non is associated + */ + ModelElementInstance getModelElementInstance(); + + /** + * Sets the {@link ModelElementInstance} which should be associated with this element. + * + * @param modelElementInstance the {@link ModelElementInstance} to associate + */ + void setModelElementInstance(ModelElementInstance modelElementInstance); + + /** + * Adds a new namespace with a generated prefix to this element. + * + * @param namespaceUri the namespaceUri of the namespace + * @return the generated prefix for the new namespace + */ + String registerNamespace(String namespaceUri); + + /** + * Adds a new namespace with prefix to this element. + * + * @param prefix the prefix of the namespace + * @param namespaceUri the namespaceUri of the namespace + */ + void registerNamespace(String prefix, String namespaceUri); + + /** + * Returns the prefix of the namespace starting from this node upwards. + * The default namespace has the prefix {@code null}. + * + * @param namespaceUri the namespaceUri of the namespace + * @return the prefix or null if non is defined + */ + String lookupPrefix(String namespaceUri); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/instance/ModelElementInstance.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/instance/ModelElementInstance.java new file mode 100644 index 0000000000000000000000000000000000000000..bc28380d8bc759db5c2550f832f368d65830046a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/instance/ModelElementInstance.java @@ -0,0 +1,261 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.instance; + +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.type.ModelElementType; + +import java.util.Collection; + +/** + * An instance of a {@link ModelElementType} + * + * @author Daniel Meyer + * + */ +public interface ModelElementInstance { + + /** + * Returns the represented DOM {@link DomElement}. + * + * @return the DOM element + */ + DomElement getDomElement(); + + /** + * Returns the model instance which contains this type instance. + * + * @return the model instance + */ + + ModelInstance getModelInstance(); + /** + * Returns the parent element of this. + * + * @return the parent element + */ + ModelElementInstance getParentElement(); + + /** + * Returns the element type of this. + * + * @return the element type + */ + ModelElementType getElementType(); + + /** + * Returns the attribute value for the attribute name. + * + * @param attributeName the name of the attribute + * @return the value of the attribute + */ + String getAttributeValue(String attributeName); + + /** + * Sets the value by name of a non-ID attribute. + * + * @param attributeName the name of the attribute + * @param xmlValue the value to set + */ + void setAttributeValue(String attributeName, String xmlValue); + + /** + * Sets attribute value by name. + * + * @param attributeName the name of the attribute + * @param xmlValue the value to set + * @param isIdAttribute true if the attribute is an ID attribute, false otherwise + */ + void setAttributeValue(String attributeName, String xmlValue, boolean isIdAttribute); + + /** + * Sets attribute value by name. + * + * @param attributeName the name of the attribute + * @param xmlValue the value to set + * @param isIdAttribute true if the attribute is an ID attribute, false otherwise + * @param withReferenceUpdate true to update incoming references in other elements, false otherwise + */ + void setAttributeValue(String attributeName, String xmlValue, + boolean isIdAttribute, boolean withReferenceUpdate); + + /** + * Removes attribute by name. + * + * @param attributeName the name of the attribute + */ + void removeAttribute(String attributeName); + + /** + * Returns the attribute value for the given attribute name and namespace URI. + * + * @param namespaceUri the namespace URI of the attribute + * @param attributeName the attribute name of the attribute + * @return the value of the attribute + */ + String getAttributeValueNs(String namespaceUri, String attributeName); + + /** + * Sets the value by name and namespace of a non-ID attribute. + * + * @param namespaceUri the namespace URI of the attribute + * @param attributeName the name of the attribute + * @param xmlValue the XML value to set + */ + void setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue); + + /** + * Sets the attribute value by name and namespace. + * + * @param namespaceUri the namespace URI of the attribute + * @param attributeName the name of the attribute + * @param xmlValue the XML value to set + * @param isIdAttribute true if the attribute is an ID attribute, false otherwise + */ + void setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue, boolean isIdAttribute); + + /** + * Sets the attribute value by name and namespace. + * + * @param namespaceUri the namespace URI of the attribute + * @param attributeName the name of the attribute + * @param xmlValue the XML value to set + * @param isIdAttribute true if the attribute is an ID attribute, false otherwise + * @param withReferenceUpdate true to update incoming references in other elements, false otherwise + */ + void setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue, + boolean isIdAttribute, boolean withReferenceUpdate); + + /** + * Removes the attribute by name and namespace. + * + * @param namespaceUri the namespace URI of the attribute + * @param attributeName the name of the attribute + */ + void removeAttributeNs(String namespaceUri, String attributeName); + + /** + * Returns the text content of the DOM element without leading and trailing spaces. For + * raw text content see {@link ModelElementInstanceImpl#getRawTextContent()}. + * + * @return text content of underlying DOM element with leading and trailing whitespace trimmed + */ + String getTextContent(); + + /** + * Returns the raw text content of the DOM element including all whitespaces. + * + * @return raw text content of underlying DOM element + */ + String getRawTextContent(); + + /** + * Sets the text content of the DOM element + * + * @param textContent the new text content + */ + void setTextContent(String textContent); + + /** + * Replaces this element with a new element and updates references. + * + * @param newElement the new element to replace with + */ + void replaceWithElement(ModelElementInstance newElement); + + /** + * Returns a child element with the given name or 'null' if no such element exists + * + * @param namespaceUri the local name of the element + * @param elementName the namespace of the element + * @return the child element or null. + */ + ModelElementInstance getUniqueChildElementByNameNs(String namespaceUri, String elementName); + + /** + * Returns a child element with the given type + * + * @param elementType the type of the element + * @return the child element or null + */ + ModelElementInstance getUniqueChildElementByType(Class elementType); + + /** + * Adds or replaces a child element by name. Replaces an existing Child Element with the same name + * or adds a new child if no such element exists. + * + * @param newChild the child to add + */ + void setUniqueChildElementByNameNs(ModelElementInstance newChild); + + /** + * Replace an existing child element with a new child element. Changes the underlying DOM element tree. + * + * @param existingChild the child element to replace + * @param newChild the new child element + */ + void replaceChildElement(ModelElementInstance existingChild, ModelElementInstance newChild); + + /** + * Adds a new child element to the children of this element. The child + * is inserted at the correct position of the allowed child types. + * Updates the underlying DOM element tree. + * + * @param newChild the new child element + * @throws ModelException if the new child type is not an allowed child type + */ + void addChildElement(ModelElementInstance newChild); + + /** + * Removes the child element from this. + * + * @param child the child element to remove + * @return true if the child element could be removed + */ + boolean removeChildElement(ModelElementInstance child); + + /** + * Return all child elements of a given type + * + * @param childElementType the child element type to search for + * @return a collection of elements of the given type + */ + Collection getChildElementsByType(ModelElementType childElementType); + + /** + * Return all child elements of a given type + * + * @param childElementClass the class of the child element type to search for + * @return a collection of elements to the given type + */ + Collection getChildElementsByType(Class childElementClass); + + /** + * Inserts the new element after the given element or at the beginning if the given element is null. + * + * @param elementToInsert the new element to insert + * @param insertAfterElement the element to insert after or null to insert at first position + */ + void insertElementAfter(ModelElementInstance elementToInsert, ModelElementInstance insertAfterElement); + + /** + * Execute updates after the element was inserted as a replacement of another element. + */ + void updateAfterReplacement(); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/AbstractModelElementInstanceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/AbstractModelElementInstanceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2e726d3c62edc94bdd15fede839b9ebd8db05090 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/AbstractModelElementInstanceTest.java @@ -0,0 +1,286 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.test; + +import static org.camunda.bpm.model.xml.test.assertions.ModelAssertions.assertThat; +import static org.junit.Assert.fail; + +import java.util.Collection; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl; +import org.camunda.bpm.model.xml.impl.util.ModelTypeException; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.test.assertions.AttributeAssert; +import org.camunda.bpm.model.xml.test.assertions.ChildElementAssert; +import org.camunda.bpm.model.xml.test.assertions.ModelElementTypeAssert; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.junit.Test; +import org.w3c.dom.DOMException; + +public abstract class AbstractModelElementInstanceTest { + + + protected class TypeAssumption { + + public final String namespaceUri; + public final ModelElementType extendsType; + public final boolean isAbstract; + + public TypeAssumption(boolean isAbstract) { + this(getDefaultNamespace(), isAbstract); + } + + public TypeAssumption(String namespaceUri, boolean isAbstract) { + this(namespaceUri, null, isAbstract); + } + + public TypeAssumption(Class extendsType, boolean isAbstract) { + this(getDefaultNamespace(), extendsType, isAbstract); + } + + public TypeAssumption(String namespaceUri, Class extendsType, boolean isAbstract) { + this.namespaceUri = namespaceUri; + this.extendsType = model.getType(extendsType); + this.isAbstract = isAbstract; + } + } + + protected class ChildElementAssumption { + + public final String namespaceUri; + public final ModelElementType childElementType; + public final int minOccurs; + public final int maxOccurs; + + public ChildElementAssumption(Class childElementType) { + this(childElementType, 0, -1); + } + + public ChildElementAssumption(String namespaceUri, Class childElementType) { + this(namespaceUri, childElementType, 0, -1); + } + + public ChildElementAssumption(Class childElementType, int minOccurs) { + this(childElementType, minOccurs, -1); + } + + public ChildElementAssumption(String namespaceUri, Class childElementType, int minOccurs) { + this(namespaceUri, childElementType, minOccurs, -1); + } + + public ChildElementAssumption(Class childElementType, int minOccurs, int maxOccurs) { + this(getDefaultNamespace(), childElementType, minOccurs, maxOccurs); + } + + public ChildElementAssumption(String namespaceUri, Class childElementType, int minOccurs, int maxOccurs) { + this.namespaceUri = namespaceUri; + this.childElementType = model.getType(childElementType); + this.minOccurs = minOccurs; + this.maxOccurs = maxOccurs; + } + } + + protected class AttributeAssumption { + + public final String attributeName; + public final String namespace; + public final boolean isIdAttribute; + public final boolean isRequired; + public final Object defaultValue; + + public AttributeAssumption(String attributeName) { + this(attributeName, false, false); + } + + public AttributeAssumption(String namespace, String attributeName) { + this(namespace, attributeName, false, false); + } + + public AttributeAssumption(String attributeName, boolean isIdAttribute) { + this(attributeName, isIdAttribute, false); + } + + public AttributeAssumption(String namespace, String attributeName, boolean isIdAttribute) { + this(namespace, attributeName, isIdAttribute, false); + } + + public AttributeAssumption(String attributeName, boolean isIdAttribute, boolean isRequired) { + this(attributeName, isIdAttribute, isRequired, null); + } + + public AttributeAssumption(String namespace, String attributeName, boolean isIdAttribute, boolean isRequired) { + this(namespace, attributeName, isIdAttribute, isRequired, null); + } + + public AttributeAssumption(String attributeName, boolean isIdAttribute, boolean isRequired, Object defaultValue) { + this(null, attributeName, isIdAttribute, isRequired, defaultValue); + } + + public AttributeAssumption(String namespace, String attributeName, boolean isIdAttribute, boolean isRequired, Object defaultValue) { + this.attributeName = attributeName; + this.namespace = namespace; + this.isIdAttribute = isIdAttribute; + this.isRequired = isRequired; + this.defaultValue = defaultValue; + } + } + + public static ModelInstance modelInstance; + public static Model model; + public static ModelElementType modelElementType; + + public static void initModelElementType(GetModelElementTypeRule modelElementTypeRule) { + modelInstance = modelElementTypeRule.getModelInstance(); + model = modelElementTypeRule.getModel(); + modelElementType = modelElementTypeRule.getModelElementType(); + assertThat(modelInstance).isNotNull(); + assertThat(model).isNotNull(); + assertThat(modelElementType).isNotNull(); + } + + public abstract String getDefaultNamespace(); + public abstract TypeAssumption getTypeAssumption(); + public abstract Collection getChildElementAssumptions(); + public abstract Collection getAttributesAssumptions(); + + + public ModelElementTypeAssert assertThatType() { + return assertThat(modelElementType); + } + + public AttributeAssert assertThatAttribute(String attributeName) { + return assertThat(modelElementType.getAttribute(attributeName)); + } + + public ChildElementAssert assertThatChildElement(ModelElementType childElementType) { + ModelElementTypeImpl modelElementTypeImpl = (ModelElementTypeImpl) modelElementType; + return assertThat(modelElementTypeImpl.getChildElementCollection(childElementType)); + } + + public ModelElementType getType(Class instanceClass) { + return model.getType(instanceClass); + } + + @Test + public void testType() { + assertThatType().isPartOfModel(model); + + TypeAssumption assumption = getTypeAssumption(); + assertThatType().hasTypeNamespace(assumption.namespaceUri); + + if (assumption.isAbstract) { + assertThatType().isAbstract(); + } + else { + assertThatType().isNotAbstract(); + } + if (assumption.extendsType == null) { + assertThatType().extendsNoType(); + } + else { + assertThatType().extendsType(assumption.extendsType); + } + + if (assumption.isAbstract) { + try { + modelInstance.newInstance(modelElementType); + fail("Element type " + modelElementType.getTypeName() + " is abstract."); + } + catch (DOMException e) { + // expected exception + } + catch (ModelTypeException e) { + // expected exception + } + catch (Exception e) { + fail("Unexpected exception " + e.getMessage()); + } + } + else { + ModelElementInstance modelElementInstance = modelInstance.newInstance(modelElementType); + assertThat(modelElementInstance).isNotNull(); + } + } + + @Test + public void testChildElements() { + Collection childElementAssumptions = getChildElementAssumptions(); + if (childElementAssumptions == null) { + assertThatType().hasNoChildElements(); + } + else { + assertThat(modelElementType.getChildElementTypes().size()).isEqualTo(childElementAssumptions.size()); + for (ChildElementAssumption assumption : childElementAssumptions) { + assertThatType().hasChildElements(assumption.childElementType); + if (assumption.namespaceUri != null) { + assertThat(assumption.childElementType).hasTypeNamespace(assumption.namespaceUri); + } + assertThatChildElement(assumption.childElementType) + .occursMinimal(assumption.minOccurs) + .occursMaximal(assumption.maxOccurs); + } + } + } + + @Test + public void testAttributes() { + Collection attributesAssumptions = getAttributesAssumptions(); + if (attributesAssumptions == null) { + assertThatType().hasNoAttributes(); + } + else { + assertThat(attributesAssumptions).hasSameSizeAs(modelElementType.getAttributes()); + for (AttributeAssumption assumption : attributesAssumptions) { + assertThatType().hasAttributes(assumption.attributeName); + AttributeAssert attributeAssert = assertThatAttribute(assumption.attributeName); + + attributeAssert.hasOwningElementType(modelElementType); + + if (assumption.namespace != null) { + attributeAssert.hasNamespaceUri(assumption.namespace); + } + else { + attributeAssert.hasNoNamespaceUri(); + } + + if (assumption.isIdAttribute) { + attributeAssert.isIdAttribute(); + } + else { + attributeAssert.isNotIdAttribute(); + } + + if (assumption.isRequired) { + attributeAssert.isRequired(); + } + else { + attributeAssert.isOptional(); + } + + if (assumption.defaultValue == null) { + attributeAssert.hasNoDefaultValue(); + } + else { + attributeAssert.hasDefaultValue(assumption.defaultValue); + } + + } + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/GetModelElementTypeRule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/GetModelElementTypeRule.java new file mode 100644 index 0000000000000000000000000000000000000000..45057c36861ce066bb5089e69218fdb4cc3f8116 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/GetModelElementTypeRule.java @@ -0,0 +1,32 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.test; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.junit.rules.TestRule; + +public interface GetModelElementTypeRule extends TestRule { + + ModelInstance getModelInstance(); + + Model getModel(); + + ModelElementType getModelElementType(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/AbstractReferenceAssert.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/AbstractReferenceAssert.java new file mode 100644 index 0000000000000000000000000000000000000000..07b937724c9c2cd62bcac067d8e8a1eb69bff7c3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/AbstractReferenceAssert.java @@ -0,0 +1,80 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.test.assertions; + +import org.assertj.core.api.AbstractAssert; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.reference.Reference; + +/** + * @author Sebastian Menski + */ +public abstract class AbstractReferenceAssert, T extends Reference> extends AbstractAssert { + + protected AbstractReferenceAssert(T actual, Class selfType) { + super(actual, selfType); + } + + public S hasIdentifier(ModelElementInstance instance, String identifier) { + isNotNull(); + + String actualIdentifier = actual.getReferenceIdentifier(instance); + + if (!identifier.equals(actualIdentifier)) { + failWithMessage("Expected reference <%s> to have identifier <%s> but was <%s>", actual, identifier, actualIdentifier); + } + + return myself; + } + + public S hasTargetElement(ModelElementInstance instance, ModelElementInstance targetElement) { + isNotNull(); + + ModelElementInstance actualTargetElement = actual.getReferenceTargetElement(instance); + + if (!targetElement.equals(actualTargetElement)) { + failWithMessage("Expected reference <%s> to have target element <%s> but was <%s>", actual, targetElement, actualTargetElement); + } + + return myself; + } + + public S hasNoTargetElement(ModelElementInstance instance) { + isNotNull(); + + ModelElementInstance actualTargetElement = actual.getReferenceTargetElement(instance); + + if (actualTargetElement != null) { + failWithMessage("Expected reference <%s> to have no target element but has <%s>", actualTargetElement, actualTargetElement); + } + + return myself; + } + + public S hasTargetAttribute(Attribute targetAttribute) { + isNotNull(); + + Attribute actualTargetAttribute = actual.getReferenceTargetAttribute(); + + if (!targetAttribute.equals(actualTargetAttribute)) { + failWithMessage("Expected reference <%s> to have target attribute <%s> but was <%s>", actual, targetAttribute, actualTargetAttribute); + } + + return myself; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/AttributeAssert.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/AttributeAssert.java new file mode 100644 index 0000000000000000000000000000000000000000..5890350fbf259236fd157da8662885bf5118973b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/AttributeAssert.java @@ -0,0 +1,258 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.test.assertions; + +import org.assertj.core.api.AbstractAssert; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.reference.Reference; + +import java.util.Arrays; +import java.util.List; + +/** + * @author Sebastian Menski + */ +public class AttributeAssert extends AbstractAssert> { + + private final String attributeName; + + protected AttributeAssert(Attribute actual) { + super(actual, AttributeAssert.class); + attributeName = actual.getAttributeName(); + } + + public AttributeAssert isRequired() { + isNotNull(); + + if (!actual.isRequired()) { + failWithMessage("Expected attribute <%s> to be required but was not", attributeName); + } + + return this; + } + + public AttributeAssert isOptional() { + isNotNull(); + + if (actual.isRequired()) { + failWithMessage("Expected attribute <%s> to be optional but was required", attributeName); + } + + return this; + } + + public AttributeAssert isIdAttribute() { + isNotNull(); + + if (!actual.isIdAttribute()) { + failWithMessage("Expected attribute <%s> to be an ID attribute but was not", attributeName); + } + + return this; + } + + public AttributeAssert isNotIdAttribute() { + isNotNull(); + + if (actual.isIdAttribute()) { + failWithMessage("Expected attribute <%s> to be not an ID attribute but was", attributeName); + } + + return this; + } + + public AttributeAssert hasDefaultValue(Object defaultValue) { + isNotNull(); + + Object actualDefaultValue = actual.getDefaultValue(); + + if (!defaultValue.equals(actualDefaultValue)) { + failWithMessage("Expected attribute <%s> to have default value <%s> but was <%s>", attributeName, defaultValue, actualDefaultValue); + } + + return this; + } + + public AttributeAssert hasNoDefaultValue() { + isNotNull(); + + Object actualDefaultValue = actual.getDefaultValue(); + + if (actualDefaultValue != null) { + failWithMessage("Expected attribute <%s> to have no default value but was <%s>", attributeName, actualDefaultValue); + } + + return this; + } + + public AttributeAssert hasOwningElementType(ModelElementType owningElementType) { + isNotNull(); + + ModelElementType actualOwningElementType = actual.getOwningElementType(); + + if (!owningElementType.equals(actualOwningElementType)) { + failWithMessage("Expected attribute <%s> to have owning element type <%s> but was <%s>", attributeName, owningElementType, actualOwningElementType); + } + + return this; + } + + public AttributeAssert hasValue(ModelElementInstance modelElementInstance) { + isNotNull(); + + Object actualValue = actual.getValue(modelElementInstance); + + if (actualValue == null) { + failWithMessage("Expected attribute <%s> to have a value but has not", attributeName); + } + + return this; + } + + public AttributeAssert hasValue(ModelElementInstance modelElementInstance, Object value) { + isNotNull(); + + Object actualValue = actual.getValue(modelElementInstance); + + if (!value.equals(actualValue)) { + failWithMessage("Expected attribute <%s> to have value <%s> but was <%s>", attributeName, value, actualValue); + } + + return this; + } + + public AttributeAssert hasNoValue(ModelElementInstance modelElementInstance) { + isNotNull(); + + Object actualValue = actual.getValue(modelElementInstance); + + if (actualValue != null) { + failWithMessage("Expected attribute <%s> to have no value but was <%s>", attributeName, actualValue); + } + + return this; + } + public AttributeAssert hasAttributeName(String attributeName) { + isNotNull(); + + if (!attributeName.equals(this.attributeName)) { + failWithMessage("Expected attribute to have attribute name <%s> but was <%s>", attributeName, this.attributeName); + } + + return this; + } + + public AttributeAssert hasNamespaceUri(String namespaceUri) { + isNotNull(); + + String actualNamespaceUri1 = actual.getNamespaceUri(); + + if (!namespaceUri.equals(actualNamespaceUri1)) { + failWithMessage("Expected attribute <%s> to have namespace URI <%s> but was <%s>", attributeName, namespaceUri, actualNamespaceUri1); + } + + return this; + } + + public AttributeAssert hasNoNamespaceUri() { + isNotNull(); + + String actualNamespaceUri = actual.getNamespaceUri(); + + if (actualNamespaceUri != null) { + failWithMessage("Expected attribute <%s> to have no namespace URI but was <%s>", attributeName, actualNamespaceUri); + } + + return this; + } + + public AttributeAssert hasIncomingReferences() { + isNotNull(); + + List> actualIncomingReferences = actual.getIncomingReferences(); + + if (actualIncomingReferences.isEmpty()) { + failWithMessage("Expected attribute <%s> to have incoming references but has not", attributeName); + } + + return this; + } + + public AttributeAssert hasIncomingReferences(Reference... references) { + isNotNull(); + + List> incomingReferences = Arrays.asList(references); + List> actualIncomingReferences = actual.getIncomingReferences(); + + if (!actualIncomingReferences.containsAll(incomingReferences)) { + failWithMessage("Expected attribute <%s> to have incoming references <%s> but has <%s>", attributeName, incomingReferences, actualIncomingReferences); + } + + return this; + } + + public AttributeAssert hasNoIncomingReferences() { + isNotNull(); + + List> actualIncomingReferences = actual.getIncomingReferences(); + + if (!actualIncomingReferences.isEmpty()) { + failWithMessage("Expected attribute <%s> to have no incoming references but has <%s>", attributeName, actualIncomingReferences); + } + + return this; + } + + public AttributeAssert hasOutgoingReferences() { + isNotNull(); + + List> actualOutgoingReferences = actual.getOutgoingReferences(); + + if (actualOutgoingReferences.isEmpty()) { + failWithMessage("Expected attribute <%s> to have outgoing references but has not", attributeName); + } + + return this; + } + + public AttributeAssert hasOutgoingReferences(Reference... references) { + isNotNull(); + + List> outgoingReferences = Arrays.asList(references); + List> actualOutgoingReferences = actual.getOutgoingReferences(); + + if (!actualOutgoingReferences.containsAll(outgoingReferences)) { + failWithMessage("Expected attribute <%s> to have outgoing references <%s> but has <%s>", attributeName, outgoingReferences, actualOutgoingReferences); + } + + return this; + } + + public AttributeAssert hasNoOutgoingReferences() { + isNotNull(); + + List> actualOutgoingReferences = actual.getOutgoingReferences(); + + if (!actualOutgoingReferences.isEmpty()) { + failWithMessage("Expected attribute <%s> to have no outgoing references but has <%s>", attributeName, actualOutgoingReferences); + } + + return this; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/AttributeReferenceAssert.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/AttributeReferenceAssert.java new file mode 100644 index 0000000000000000000000000000000000000000..6c95fc179f6ea355675bfe16d05f4f1b5cda4111 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/AttributeReferenceAssert.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.test.assertions; + +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.reference.AttributeReference; + +/** + * @author Sebastian Menski + */ +public class AttributeReferenceAssert extends AbstractReferenceAssert> { + + protected AttributeReferenceAssert(AttributeReference actual) { + super(actual, AttributeReferenceAssert.class); + } + + public AttributeReferenceAssert hasSourceAttribute(Attribute sourceAttribute) { + isNotNull(); + + Attribute actualSourceAttribute = actual.getReferenceSourceAttribute(); + + if (!sourceAttribute.equals(actualSourceAttribute)) { + failWithMessage("Expected reference <%s> to have source attribute <%s> but was <%s>", actual, sourceAttribute, actualSourceAttribute); + } + + return this; + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/ChildElementAssert.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/ChildElementAssert.java new file mode 100644 index 0000000000000000000000000000000000000000..c34ae3a4a219555896a5b92f833f90abaaeff418 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/ChildElementAssert.java @@ -0,0 +1,167 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.test.assertions; + +import org.assertj.core.api.AbstractAssert; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; + +/** + * @author Sebastian Menski + */ +public class ChildElementAssert extends AbstractAssert> { + + private final Class typeClass; + + protected ChildElementAssert(ChildElementCollection actual) { + super(actual, ChildElementAssert.class); + typeClass = actual.getChildElementTypeClass(); + } + + public ChildElementAssert occursMinimal(int minOccurs) { + isNotNull(); + + int actualMinOccurs = actual.getMinOccurs(); + + if (actualMinOccurs != minOccurs) { + failWithMessage("Expected child element <%s> to have a min occurs of <%s> but was <%s>", typeClass, minOccurs, actualMinOccurs); + } + + return this; + } + + public ChildElementAssert occursMaximal(int maxOccurs) { + isNotNull(); + + int actualMaxOccurs = actual.getMaxOccurs(); + + if (actualMaxOccurs != maxOccurs) { + failWithMessage("Expected child element <%s> to have a max occurs of <%s> but was <%s>", typeClass, maxOccurs, actualMaxOccurs); + } + + return this; + } + + public ChildElementAssert isOptional() { + isNotNull(); + + int actualMinOccurs = actual.getMinOccurs(); + + if (actualMinOccurs != 0) { + failWithMessage("Expected child element <%s> to be optional but has min occurs of <%s>", typeClass, actualMinOccurs); + } + + return this; + } + + public ChildElementAssert isUnbounded() { + isNotNull(); + + int actualMaxOccurs = actual.getMaxOccurs(); + + if (actualMaxOccurs != -1) { + failWithMessage("Expected child element <%s> to be unbounded but has a max occurs of <%s>", typeClass, actualMaxOccurs); + } + + return this; + } + + public ChildElementAssert isMutable() { + isNotNull(); + + boolean actualImmutable = actual.isImmutable(); + + if (actualImmutable) { + failWithMessage("Expected child element <%s> to be mutable but was not", typeClass); + } + + return this; + } + + public ChildElementAssert isImmutable() { + isNotNull(); + + boolean actualImmutable = actual.isImmutable(); + + if (!actualImmutable) { + failWithMessage("Expected child element <%s> to be immutable but was not", typeClass); + } + + return this; + } + + public ChildElementAssert containsType(Class childElementTypeClass) { + isNotNull(); + + Class actualChildElementTypeClass = actual.getChildElementTypeClass(); + + if (!childElementTypeClass.equals(actualChildElementTypeClass)) { + failWithMessage("Expected child element <%s> to contain elements of type <%s> but contains elements of type <%s>", typeClass, childElementTypeClass, actualChildElementTypeClass); + } + + return this; + } + + public ChildElementAssert hasParentElementType(ModelElementType parentElementType) { + isNotNull(); + + ModelElementType actualParentElementType = actual.getParentElementType(); + + if (!parentElementType.equals(actualParentElementType)) { + failWithMessage("Expected child element <%s> to have parent element type <%s> but has <%s>", typeClass, parentElementType.getTypeName(), actualParentElementType.getTypeName()); + } + + return this; + } + + public ChildElementAssert isNotEmpty(ModelElementInstance instance) { + isNotNull(); + + int actualNumberOfChildElements = actual.get(instance).size(); + + if (actualNumberOfChildElements == 0) { + failWithMessage("Expected child element <%s> to contain elements but was not", typeClass); + } + + return this; + } + + public ChildElementAssert hasSize(ModelElementInstance instance, int numberOfChildElements) { + isNotNull(); + + int actualNumberOfChildElements = actual.get(instance).size(); + + if (actualNumberOfChildElements != numberOfChildElements) { + failWithMessage("Expected child element <%s> to contain <%s> elements but has <%s>", typeClass, numberOfChildElements, actualNumberOfChildElements); + } + + return this; + } + + public ChildElementAssert isEmpty(ModelElementInstance instance) { + isNotNull(); + + int actualNumberOfChildElements = actual.get(instance).size(); + + if (actualNumberOfChildElements > 0) { + failWithMessage("Expected child element <%s> to contain no elements but contains <%s> elements", typeClass, actualNumberOfChildElements); + } + + return this; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/ElementReferenceCollectionAssert.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/ElementReferenceCollectionAssert.java new file mode 100644 index 0000000000000000000000000000000000000000..eab619f57f8a7cf91a0f14ab437bb3ed5b9ec666 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/ElementReferenceCollectionAssert.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.test.assertions; + +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollection; + +/** + * @author Sebastian Menski + */ +public class ElementReferenceCollectionAssert extends AbstractReferenceAssert> { + + protected ElementReferenceCollectionAssert(ElementReferenceCollection actual) { + super(actual, ElementReferenceCollectionAssert.class); + } + +} + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/ModelAssertions.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/ModelAssertions.java new file mode 100644 index 0000000000000000000000000000000000000000..963d4d4da15c8165668260827c0e59ead358d137 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/ModelAssertions.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.test.assertions; + +import org.assertj.core.api.Assertions; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.reference.AttributeReference; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollection; + +/** + * @author Sebastian Menski + */ +public class ModelAssertions extends Assertions { + + public static AttributeAssert assertThat(Attribute actual) { + return new AttributeAssert(actual); + } + + public static ModelElementTypeAssert assertThat(ModelElementType actual) { + return new ModelElementTypeAssert(actual); + } + + public static ChildElementAssert assertThat(ChildElementCollection actual) { + return new ChildElementAssert(actual); + } + + public static AttributeReferenceAssert assertThat(AttributeReference actual) { + return new AttributeReferenceAssert(actual); + } + + public static ElementReferenceCollectionAssert assertThat(ElementReferenceCollection actual) { + return new ElementReferenceCollectionAssert(actual); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/ModelElementTypeAssert.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/ModelElementTypeAssert.java new file mode 100644 index 0000000000000000000000000000000000000000..8ba841e820fc5fd6937c8e30460343781e3d111f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/test/assertions/ModelElementTypeAssert.java @@ -0,0 +1,287 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.test.assertions; + +import org.assertj.core.api.AbstractAssert; +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.impl.util.QName; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.attribute.Attribute; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +/** + * @author Sebastian Menski + */ +public class ModelElementTypeAssert extends AbstractAssert { + + private final String typeName; + + protected ModelElementTypeAssert(ModelElementType actual) { + super(actual, ModelElementTypeAssert.class); + typeName = actual.getTypeName(); + } + + private List getActualAttributeNames() { + List actualAttributeNames = new ArrayList(); + for (Attribute attribute : actual.getAttributes()) { + actualAttributeNames.add(attribute.getAttributeName()); + } + return actualAttributeNames; + } + + private Collection getTypeNames(Collection elementTypes) { + List typeNames = new ArrayList(); + QName qName; + for (ModelElementType elementType : elementTypes) { + qName = new QName(elementType.getTypeNamespace(), elementType.getTypeName()); + typeNames.add(qName.toString()); + } + return typeNames; + } + + public ModelElementTypeAssert isAbstract() { + isNotNull(); + + if (!actual.isAbstract()) { + failWithMessage("Expected element type <%s> to be abstract but was not", typeName); + } + + return this; + } + + public ModelElementTypeAssert isNotAbstract() { + isNotNull(); + + if (actual.isAbstract()) { + failWithMessage("Expected element type <%s> not to be abstract but was", typeName); + } + + return this; + } + + public ModelElementTypeAssert extendsType(ModelElementType baseType) { + isNotNull(); + + ModelElementType actualBaseType = actual.getBaseType(); + + if (!actualBaseType.equals(baseType)) { + failWithMessage("Expected element type <%s> to extend type <%s> but extends <%s>", typeName, actualBaseType.getTypeName(), baseType.getTypeName()); + } + + return this; + } + + public ModelElementTypeAssert extendsNoType() { + isNotNull(); + + ModelElementType actualBaseType = actual.getBaseType(); + + if (actualBaseType != null) { + failWithMessage("Expected element type <%s> to not extend any type but extends <%s>", typeName, actualBaseType.getTypeName()); + } + + return this; + } + + public ModelElementTypeAssert hasAttributes() { + isNotNull(); + + List> actualAttributes = actual.getAttributes(); + + if (actualAttributes.isEmpty()) { + failWithMessage("Expected element type <%s> to have attributes but has none", typeName); + } + + return this; + } + + public ModelElementTypeAssert hasAttributes(String... attributeNames) { + isNotNull(); + + List actualAttributeNames = getActualAttributeNames(); + + if (!actualAttributeNames.containsAll(Arrays.asList(attributeNames))) { + failWithMessage("Expected element type <%s> to have attributes <%s> but has <%s>", typeName, attributeNames, actualAttributeNames); + } + + return this; + } + + public ModelElementTypeAssert hasNoAttributes() { + isNotNull(); + + List actualAttributeNames = getActualAttributeNames(); + + if (!actualAttributeNames.isEmpty()) { + failWithMessage("Expected element type <%s> to have no attributes but has <%s>", typeName, actualAttributeNames); + } + + return this; + } + + public ModelElementTypeAssert hasChildElements() { + isNotNull(); + + List childElementTypes = actual.getChildElementTypes(); + + if (childElementTypes.isEmpty()) { + failWithMessage("Expected element type <%s> to have child elements but has non", typeName); + } + + return this; + } + + public ModelElementTypeAssert hasChildElements(ModelElementType... types) { + isNotNull(); + + List childElementTypes = Arrays.asList(types); + List actualChildElementTypes = actual.getChildElementTypes(); + + if (!actualChildElementTypes.containsAll(childElementTypes)) { + Collection typeNames = getTypeNames(childElementTypes); + Collection actualTypeNames = getTypeNames(actualChildElementTypes); + failWithMessage("Expected element type <%s> to have child elements <%s> but has <%s>", typeName, typeNames, actualTypeNames); + } + + return this; + } + + public ModelElementTypeAssert hasNoChildElements() { + isNotNull(); + + Collection actualChildElementTypeNames = getTypeNames(actual.getChildElementTypes()); + + if (!actualChildElementTypeNames.isEmpty()) { + failWithMessage("Expected element type <%s> to have no child elements but has <%s>", typeName, actualChildElementTypeNames); + } + + return this; + } + + public ModelElementTypeAssert hasTypeName(String typeName) { + isNotNull(); + + if (!typeName.equals(this.typeName)) { + failWithMessage("Expected element type to have name <%s> but was <%s>", typeName, this.typeName); + } + + return this; + } + + public ModelElementTypeAssert hasTypeNamespace(String typeNamespace) { + isNotNull(); + + String actualTypeNamespace = actual.getTypeNamespace(); + + if (!typeNamespace.equals(actualTypeNamespace)) { + failWithMessage("Expected element type <%s> has type namespace <%s> but was <%s>", typeName, typeNamespace, actualTypeNamespace); + } + + return this; + } + + public ModelElementTypeAssert hasInstanceType(Class instanceType) { + isNotNull(); + + Class actualInstanceType = actual.getInstanceType(); + + if (!instanceType.equals(actualInstanceType)) { + failWithMessage("Expected element type <%s> has instance type <%s> but was <%s>", typeName, instanceType, actualInstanceType); + } + + return this; + } + + public ModelElementTypeAssert isExtended() { + isNotNull(); + + Collection actualExtendingTypes = actual.getExtendingTypes(); + + if (actualExtendingTypes.isEmpty()) { + failWithMessage("Expected element type <%s> to be extended by types but was not", typeName); + } + + return this; + } + + public ModelElementTypeAssert isExtendedBy(ModelElementType... types) { + isNotNull(); + + List extendingTypes = Arrays.asList(types); + Collection actualExtendingTypes = actual.getExtendingTypes(); + + if (!actualExtendingTypes.containsAll(extendingTypes)) { + Collection typeNames = getTypeNames(extendingTypes); + Collection actualTypeNames = getTypeNames(actualExtendingTypes); + failWithMessage("Expected element type <%s> to be extended by types <%s> but is extended by <%s>", typeName, typeNames, actualTypeNames); + } + + return this; + } + + public ModelElementTypeAssert isNotExtended() { + isNotNull(); + + Collection actualExtendingTypeNames = getTypeNames(actual.getExtendingTypes()); + + if (!actualExtendingTypeNames.isEmpty()) { + failWithMessage("Expected element type <%s> to be not extend but is extended by <%s>", typeName, actualExtendingTypeNames); + } + + return this; + } + + public ModelElementTypeAssert isNotExtendedBy(ModelElementType... types) { + isNotNull(); + + List notExtendingTypes = Arrays.asList(types); + Collection actualExtendingTypes = actual.getExtendingTypes(); + + List errorTypes = new ArrayList(); + + for (ModelElementType notExtendingType : notExtendingTypes) { + if (actualExtendingTypes.contains(notExtendingType)) { + errorTypes.add(notExtendingType); + } + } + + if (!errorTypes.isEmpty()) { + Collection errorTypeNames = getTypeNames(errorTypes); + Collection notExtendingTypeNames = getTypeNames(notExtendingTypes); + failWithMessage("Expected element type <%s> to be not extended by types <%s> but is extended by <%s>", typeName, notExtendingTypeNames, errorTypeNames); + } + + return this; + } + + public ModelElementTypeAssert isPartOfModel(Model model) { + isNotNull(); + + Model actualModel = actual.getModel(); + + if (!model.equals(actualModel)) { + failWithMessage("Expected element type <%s> to be part of model <%s> but was part of <%s>", typeName, model.getModelName(), actualModel.getModelName()); + } + + return this; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/ModelElementType.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/ModelElementType.java new file mode 100644 index 0000000000000000000000000000000000000000..2606bf261e79a7eaed0b8424d352bc4349901303 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/ModelElementType.java @@ -0,0 +1,61 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.attribute.Attribute; + +import java.util.Collection; +import java.util.List; + +/** + * @author Daniel Meyer + * + */ +public interface ModelElementType { + + String getTypeName(); + + String getTypeNamespace(); + + Class getInstanceType(); + + List> getAttributes(); + + ModelElementInstance newInstance(ModelInstance modelInstance); + + ModelElementType getBaseType(); + + boolean isAbstract(); + + Collection getExtendingTypes(); + + Collection getAllExtendingTypes(); + + Attribute getAttribute(String attributeName); + + Model getModel(); + + Collection getInstances(ModelInstance modelInstanceImpl); + + List getChildElementTypes(); + + List getAllChildElementTypes(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/ModelElementTypeBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/ModelElementTypeBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..e547dc5886626be5d92c0345f4b6b99649dd4758 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/ModelElementTypeBuilder.java @@ -0,0 +1,59 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type; + +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.attribute.AttributeBuilder; +import org.camunda.bpm.model.xml.type.attribute.StringAttributeBuilder; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +/** + * @author Daniel Meyer + */ +public interface ModelElementTypeBuilder { + + ModelElementTypeBuilder namespaceUri(String namespaceUri); + + ModelElementTypeBuilder extendsType(Class extendedType); + + ModelElementTypeBuilder instanceProvider(ModelTypeInstanceProvider instanceProvider); + + ModelElementTypeBuilder abstractType(); + + AttributeBuilder booleanAttribute(String attributeName); + + StringAttributeBuilder stringAttribute(String attributeName); + + AttributeBuilder integerAttribute(String attributeName); + + AttributeBuilder doubleAttribute(String attributeName); + + > AttributeBuilder enumAttribute(String attributeName, Class enumType); + + > AttributeBuilder namedEnumAttribute(String attributeName, Class enumType); + + SequenceBuilder sequence(); + + ModelElementType build(); + + + interface ModelTypeInstanceProvider { + T newInstance(ModelTypeInstanceContext instanceContext); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/attribute/Attribute.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/attribute/Attribute.java new file mode 100644 index 0000000000000000000000000000000000000000..eec46370b12c406d1d76ce099bd8651c9269b489 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/attribute/Attribute.java @@ -0,0 +1,78 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.attribute; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.reference.Reference; + +import java.util.List; + +/** + * @author meyerd + * + * @param + */ +public interface Attribute { + + /** + * returns the value of the attribute. + * + * @return the value of the attribute. + */ + T getValue(ModelElementInstance modelElement); + + /** + * sets the value of the attribute. + * + * @param value the value of the attribute. + */ + void setValue(ModelElementInstance modelElement, T value); + + /** + * sets the value of the attribute. + * + * @param value the value of the attribute. + * @param withReferenceUpdate true to update id references in other elements, false otherwise + */ + void setValue(ModelElementInstance modelElement, T value, boolean withReferenceUpdate); + + T getDefaultValue(); + + void removeAttribute(ModelElementInstance modelElement); + + boolean isRequired(); + + /** + * @return the namespaceUri + */ + String getNamespaceUri(); + + /** + * @return the attributeName + */ + String getAttributeName(); + + boolean isIdAttribute(); + + ModelElementType getOwningElementType(); + + List> getIncomingReferences(); + + List> getOutgoingReferences(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/attribute/AttributeBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/attribute/AttributeBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..5c819b1b893601e39d232a30420ecdda39c2162a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/attribute/AttributeBuilder.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.attribute; + + +/** + * @author Daniel Meyer + * + * @param the type of the {@link Attribute} + */ +public interface AttributeBuilder { + + AttributeBuilder namespace(String namespaceUri); + + AttributeBuilder defaultValue(T defaultValue); + + AttributeBuilder required(); + + AttributeBuilder idAttribute(); + + Attribute build(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/attribute/StringAttributeBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/attribute/StringAttributeBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..a37c362958b5d833edae6a4e9e25f160cb8ca2bd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/attribute/StringAttributeBuilder.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.attribute; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.reference.AttributeReferenceBuilder; +import org.camunda.bpm.model.xml.type.reference.AttributeReferenceCollection; +import org.camunda.bpm.model.xml.type.reference.AttributeReferenceCollectionBuilder; + +/** + * @author Sebastian Menski + * + */ +public interface StringAttributeBuilder extends AttributeBuilder { + + StringAttributeBuilder namespace(String namespaceUri); + + StringAttributeBuilder defaultValue(String defaultValue); + + StringAttributeBuilder required(); + + StringAttributeBuilder idAttribute(); + + AttributeReferenceBuilder qNameAttributeReference(Class referenceTargetElement); + + AttributeReferenceBuilder idAttributeReference(Class referenceTargetElement); + + @SuppressWarnings("rawtypes") + AttributeReferenceCollectionBuilder idAttributeReferenceCollection(Class referenceTargetElement, Class attributeReferenceCollection); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/ChildElement.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/ChildElement.java new file mode 100644 index 0000000000000000000000000000000000000000..21d69c756ca34f4dfe8e25046a7ba2d10a6a25d8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/ChildElement.java @@ -0,0 +1,58 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.child; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +import java.util.Collection; + +/** + * A single child element (child Element collection where {@link ChildElementCollection#getMaxOccurs()} returns 1. + * + * The {@link Collection#add(Object)} operation provided by this collection has special behavior: it will + * replace an existing element if it exists. + * + * @author Daniel Meyer + * + * @param the type of the child element + */ +public interface ChildElement extends ChildElementCollection { + + /** + * Sets the child element, potentially replacing an existing child element. + * + * @param element the parent element of the child element + * @param newChildElement the new child element to set + */ + void setChild(ModelElementInstance element, T newChildElement); + + /** + * Returns the child element. + * + * @param element the parent element of the child element + * @return the child element of the parent, or null if not exist + */ + T getChild(ModelElementInstance element); + + /** + * Removes the child element. + * + * @param element the parent element of the child element + * @return true if the child was remove otherwise false + */ + boolean removeChild(ModelElementInstance element); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/ChildElementBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/ChildElementBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..f082b993d30900ea0c33647414b37c0c0afbc33a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/ChildElementBuilder.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.child; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceBuilder; + +/** + * @author Daniel Meyer + * + */ +public interface ChildElementBuilder extends ChildElementCollectionBuilder { + + ChildElementBuilder immutable(); + + ChildElementBuilder required(); + + ChildElementBuilder minOccurs(int i); + + ChildElementBuilder maxOccurs(int i); + + ChildElement build(); + + ElementReferenceBuilder qNameElementReference(Class referenceTargetType); + + ElementReferenceBuilder idElementReference(Class referenceTargetType); + + ElementReferenceBuilder uriElementReference(Class referenceTargetType); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/ChildElementCollection.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/ChildElementCollection.java new file mode 100644 index 0000000000000000000000000000000000000000..381020bc9c1166f1c49cc13ae1fd5970f8440b73 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/ChildElementCollection.java @@ -0,0 +1,86 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.child; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; + +import java.util.Collection; + +/** + *

A collection containing all or a subset of the child + * elements of a given {@link ModelElementInstance}.

+ * + * @author Daniel Meyer + * + * @param The type of the model elements in the collection + */ +public interface ChildElementCollection { + + /** + * Indicates whether the collection is immutable. + * + * If the collection is immutable, all state-altering operations such + * as {@link Collection#add(Object)} or {@link Collection#remove(Object)} + * will throw an {@link UnsupportedOperationException}. + * + * @return true if the collection is mutable, false otherwise. + */ + boolean isImmutable(); + + /** + * Indicates the minimal element count of a collection. Returns a positive integer or '0'. + * @return the minimal element count of the collection. + */ + int getMinOccurs(); + + /** + * Indicates the max element count of a collection. In a negative value is returned (like '-1'), + * the collection is unbounded. + * + * @return the max element count for this collection. + */ + int getMaxOccurs(); + + /** + * Get the model element type of the elements contained in this collection. + * + * @param model the model of the element + * @return the containing {@link ModelElementType} + */ + ModelElementType getChildElementType(Model model); + + /** + * Get the class of the elements contained in this collection. + * + * @return the class of contained types + */ + Class getChildElementTypeClass(); + + /** + * Get the model element type of the element owns the collection + * + * @return the parent element of the collection + */ + ModelElementType getParentElementType(); + + /** returns a {@link Collection} containing all or a subset of the child elements of + * a {@link ModelElementInstance}. */ + Collection get(ModelElementInstance element); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/ChildElementCollectionBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/ChildElementCollectionBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..b4a3e217c198bdd49de379afab57e11dc9dd826f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/ChildElementCollectionBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.child; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollectionBuilder; + +/** + * @author Daniel Meyer + * + */ +public interface ChildElementCollectionBuilder { + + ChildElementCollectionBuilder immutable(); + + ChildElementCollectionBuilder required(); + + ChildElementCollectionBuilder minOccurs(int i); + + ChildElementCollectionBuilder maxOccurs(int i); + + ChildElementCollection build(); + + ElementReferenceCollectionBuilder qNameElementReferenceCollection(Class referenceTargetType); + + ElementReferenceCollectionBuilder idElementReferenceCollection(Class referenceTargetType); + + ElementReferenceCollectionBuilder idsElementReferenceCollection(Class referenceTargetType); + + ElementReferenceCollectionBuilder uriElementReferenceCollection(Class referenceTargetType); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/SequenceBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/SequenceBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..cdb0e34fe7658f0f67ef14603fa191312f7728ec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/child/SequenceBuilder.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.child; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * @author Daniel Meyer + * + */ +public interface SequenceBuilder { + + ChildElementBuilder element(Class childElementType); + + ChildElementCollectionBuilder elementCollection(Class childElementType); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/AttributeReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/AttributeReference.java new file mode 100644 index 0000000000000000000000000000000000000000..35b8adf8cd0da3b07c2696a0c2b71339de4b5e17 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/AttributeReference.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.reference; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.attribute.Attribute; + +/** + * @author Sebastian Menski + */ +public interface AttributeReference extends Reference { + + Attribute getReferenceSourceAttribute(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/AttributeReferenceBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/AttributeReferenceBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..1d6197132a037aff8a1ee4a78d1a8750893a117e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/AttributeReferenceBuilder.java @@ -0,0 +1,28 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.reference; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * @author Sebastian Menski + */ +public interface AttributeReferenceBuilder extends ReferenceBuilder { + + AttributeReference build(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/AttributeReferenceCollection.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/AttributeReferenceCollection.java new file mode 100644 index 0000000000000000000000000000000000000000..548fcdd04c64e682b27d36b14cb293a24b6637b8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/AttributeReferenceCollection.java @@ -0,0 +1,209 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.reference; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.UnsupportedModelOperationException; +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl; +import org.camunda.bpm.model.xml.impl.type.reference.AttributeReferenceImpl; +import org.camunda.bpm.model.xml.impl.util.ModelUtil; +import org.camunda.bpm.model.xml.impl.util.StringUtil; +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.camunda.bpm.model.xml.instance.DomElement; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * @author Roman Smirnov + * @author Sebastian Menski + * + */ +public abstract class AttributeReferenceCollection extends AttributeReferenceImpl implements AttributeReference{ + + protected String separator = " "; + + public AttributeReferenceCollection(AttributeImpl referenceSourceAttribute) { + super(referenceSourceAttribute); + } + + @Override + protected void updateReference(ModelElementInstance referenceSourceElement, String oldIdentifier, String newIdentifier) { + String referencingIdentifier = getReferenceIdentifier(referenceSourceElement); + List references = StringUtil.splitListBySeparator(referencingIdentifier, separator); + if(oldIdentifier != null && references.contains(oldIdentifier)) { + referencingIdentifier = referencingIdentifier.replace(oldIdentifier, newIdentifier); + setReferenceIdentifier(referenceSourceElement, newIdentifier); + } + } + + @Override + @SuppressWarnings("unchecked") + protected void removeReference(ModelElementInstance referenceSourceElement, ModelElementInstance referenceTargetElement) { + String identifier = getReferenceIdentifier(referenceSourceElement); + List references = StringUtil.splitListBySeparator(identifier, separator); + String identifierToRemove = getTargetElementIdentifier((T) referenceTargetElement); + references.remove(identifierToRemove); + identifier = StringUtil.joinList(references, separator); + setReferenceIdentifier(referenceSourceElement, identifier); + } + + protected abstract String getTargetElementIdentifier(T referenceTargetElement); + + private Collection getView(ModelElementInstance referenceSourceElement) { + DomDocument document = referenceSourceElement.getModelInstance().getDocument(); + + String identifier = getReferenceIdentifier(referenceSourceElement); + List references = StringUtil.splitListBySeparator(identifier, separator); + + Collection referenceTargetElements = new ArrayList(); + for (String reference : references) { + DomElement referenceTargetElement = document.getElementById(reference); + if (referenceTargetElement != null) { + referenceTargetElements.add(referenceTargetElement); + } + else { + throw new ModelException("Unable to find a model element instance for id " + identifier); + } + } + return referenceTargetElements; + } + + public Collection getReferenceTargetElements(final ModelElementInstance referenceSourceElement) { + + return new Collection() { + + public int size() { + return getView(referenceSourceElement).size(); + } + + public boolean isEmpty() { + return getView(referenceSourceElement).isEmpty(); + } + + public boolean contains(Object o) { + if (o == null) { + return false; + } + else if (!(o instanceof ModelElementInstanceImpl)) { + return false; + } + else { + return getView(referenceSourceElement).contains(((ModelElementInstanceImpl)o).getDomElement()); + } + } + + public Iterator iterator() { + Collection modelElementCollection = ModelUtil.getModelElementCollection(getView(referenceSourceElement), (ModelInstanceImpl) referenceSourceElement.getModelInstance()); + return modelElementCollection.iterator(); + } + + public Object[] toArray() { + Collection modelElementCollection = ModelUtil.getModelElementCollection(getView(referenceSourceElement), (ModelInstanceImpl) referenceSourceElement.getModelInstance()); + return modelElementCollection.toArray(); + } + + public T1[] toArray(T1[] a) { + Collection modelElementCollection = ModelUtil.getModelElementCollection(getView(referenceSourceElement), (ModelInstanceImpl) referenceSourceElement.getModelInstance()); + return modelElementCollection.toArray(a); + } + + public boolean add(T t) { + if (!contains(t)) { + performAddOperation(referenceSourceElement, t); + } + return true; + } + + public boolean remove(Object o) { + ModelUtil.ensureInstanceOf(o, ModelElementInstanceImpl.class); + performRemoveOperation(referenceSourceElement, o); + return true; + } + + public boolean containsAll(Collection c) { + Collection modelElementCollection = ModelUtil.getModelElementCollection(getView(referenceSourceElement), (ModelInstanceImpl) referenceSourceElement.getModelInstance()); + return modelElementCollection.containsAll(c); + } + + public boolean addAll(Collection c) { + boolean result = false; + for (T o: c) { + result |= add(o); + } + return result; + } + + public boolean removeAll(Collection c) { + boolean result = false; + for (Object o: c) { + result |= remove(o); + } + return result; + } + + public boolean retainAll(Collection c) { + throw new UnsupportedModelOperationException("retainAll()", "not implemented"); + } + + public void clear() { + performClearOperation(referenceSourceElement); + } + }; + + } + + protected void performClearOperation(ModelElementInstance referenceSourceElement) { + setReferenceIdentifier(referenceSourceElement, ""); + } + + @Override + protected void setReferenceIdentifier(ModelElementInstance referenceSourceElement, String referenceIdentifier) { + if (referenceIdentifier != null && !referenceIdentifier.isEmpty()) { + super.setReferenceIdentifier(referenceSourceElement, referenceIdentifier); + } else { + referenceSourceAttribute.removeAttribute(referenceSourceElement); + } + } + + /** + * @param referenceSourceElement + * @param o + */ + protected void performRemoveOperation(ModelElementInstance referenceSourceElement, Object o) { + removeReference(referenceSourceElement, (ModelElementInstance) o); + } + + protected void performAddOperation(ModelElementInstance referenceSourceElement, T referenceTargetElement) { + String identifier = getReferenceIdentifier(referenceSourceElement); + List references = StringUtil.splitListBySeparator(identifier, separator); + + String targetIdentifier = getTargetElementIdentifier(referenceTargetElement); + references.add(targetIdentifier); + + identifier = StringUtil.joinList(references, separator); + + setReferenceIdentifier(referenceSourceElement, identifier); + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/AttributeReferenceCollectionBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/AttributeReferenceCollectionBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..1b3e594767684b8c1c53faf0e2b856c1d122f38e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/AttributeReferenceCollectionBuilder.java @@ -0,0 +1,30 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.reference; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * @author Roman Smirnov + * @author Sebastian Menski + * + */ +public interface AttributeReferenceCollectionBuilder extends AttributeReferenceBuilder { + + AttributeReferenceCollection build(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ElementReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ElementReference.java new file mode 100644 index 0000000000000000000000000000000000000000..1a214a1bb4453bc1dedab2410d8058cab944dfb1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ElementReference.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.reference; + +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * @author Sebastian Menski + */ +public interface ElementReference extends ElementReferenceCollection { + + Source getReferenceSource(ModelElementInstance referenceSourceParent); + + Target getReferenceTargetElement(ModelElementInstanceImpl referenceSourceParentElement); + + void setReferenceTargetElement(ModelElementInstanceImpl referenceSourceParentElement, Target referenceTargetElement); + + void clearReferenceTargetElement(ModelElementInstanceImpl referenceSourceParentElement); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ElementReferenceBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ElementReferenceBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..86f29860a210236a2ede0564778bb6dcd4d95923 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ElementReferenceBuilder.java @@ -0,0 +1,28 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.reference; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * @author Sebastian Menski + */ +public interface ElementReferenceBuilder extends ElementReferenceCollectionBuilder { + + ElementReference build(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ElementReferenceCollection.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ElementReferenceCollection.java new file mode 100644 index 0000000000000000000000000000000000000000..c2d4a10c3d0a2b06d196b40fb9325bc5b6ba6ad2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ElementReferenceCollection.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.reference; + +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; + +import java.util.Collection; + +/** + * @author Sebastian Menski + */ +public interface ElementReferenceCollection extends Reference { + + ChildElementCollection getReferenceSourceCollection(); + + Collection getReferenceTargetElements(ModelElementInstanceImpl referenceSourceElement); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ElementReferenceCollectionBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ElementReferenceCollectionBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..68d52d500faf073b1a1388656a817bcdecbe2c54 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ElementReferenceCollectionBuilder.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.reference; + +import org.camunda.bpm.model.xml.impl.ModelBuildOperation; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * @author Sebastian Menski + */ +public interface ElementReferenceCollectionBuilder extends ModelBuildOperation { + + ElementReferenceCollection build(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/Reference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/Reference.java new file mode 100644 index 0000000000000000000000000000000000000000..1d0efd7a41d9f3dfd70d5285fc96332379ba2d6a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/Reference.java @@ -0,0 +1,58 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.reference; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.attribute.Attribute; + +import java.util.Collection; + +/** + * + * @author Sebastian Menski + * + * @param the type of the referenced element + */ +public interface Reference { + + /** + * Get the reference identifier which is set in the reference source + * + * @param referenceSourceElement the reference source model element instance + * @return the reference identifier + */ + String getReferenceIdentifier(ModelElementInstance referenceSourceElement); + + T getReferenceTargetElement(ModelElementInstance modelElement); + + void setReferenceTargetElement(ModelElementInstance referenceSourceElement, T referenceTargetElement); + + Attribute getReferenceTargetAttribute(); + + /** + * Find all reference source element instances of the reference target model element instance + * + * @param referenceTargetElement the reference target model element instance + * @return the collection of all reference source element instances + */ + Collection findReferenceSourceElements(ModelElementInstance referenceTargetElement); + + /** @return the {@link ModelElementType} of the source element. + * */ + ModelElementType getReferenceSourceElementType(); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ReferenceBuilder.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ReferenceBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..ab1861ae7a613caddca5261846c0b3e782c9e668 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/type/reference/ReferenceBuilder.java @@ -0,0 +1,30 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.reference; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * @author Sebastian Menski + * + * @param the type of the referenced element + */ +public interface ReferenceBuilder { + + Reference build(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ModelElementValidator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ModelElementValidator.java new file mode 100644 index 0000000000000000000000000000000000000000..70f89dae78e572833d1ea45cc7104e0faef70e3b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ModelElementValidator.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.validation; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * A validator for model element instances. + * + * @see ModelInstance#validate(java.util.Collection) + * @param the type of the elements to validate. + * @since 7.6 + */ +public interface ModelElementValidator { + + /** + *

The type of the element this validator is applied to. The validator is applied to all + * instances implementing this type.

+ * + *

Example from BPMN: Assume the type returned is 'Task'. Then the validator is invoked for + * all instances of task, including instances of 'ServiceTask', 'UserTask', ...

+ * + * @return the type of the element this validator is applied to. + */ + Class getElementType(); + + /** + * Validate an element. + * + * @param element the element to validate + * @param validationResultCollector object used to collect validation results for this element. + */ + void validate(T element, ValidationResultCollector validationResultCollector); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResult.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResult.java new file mode 100644 index 0000000000000000000000000000000000000000..84c9805c1c4d9e1064da35d139e0240db6899673 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResult.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.validation; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * An individual validation result. + * + * @author Daniel Meyer + * @since 7.6 + */ +public interface ValidationResult { + + /** + * @return The type of the result. + */ + ValidationResultType getType(); + + /** + * @return the element + */ + ModelElementInstance getElement(); + + /** + * @return A human consumable detail message about the validation + */ + String getMessage(); + + /** + * @return A reference code for this validation result + */ + int getCode(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResultCollector.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResultCollector.java new file mode 100644 index 0000000000000000000000000000000000000000..024bc70e57f64a0b49f240ab254a14ff726a984c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResultCollector.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.validation; + +/** + * Object passed to the {@link ModelElementValidator} to collect validation results. + * + * @author Daniel Meyer + * @since 7.6 + */ +public interface ValidationResultCollector { + + /** + * Adds an error + * + * @param code a reference code for the error + * @param message a human consumable error message + */ + void addError(int code, String message); + + /** + * Adds a warining + * + * @param code a reference code for the error + * @param message a human consumable error message + */ + void addWarning(int code, String message); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResultFormatter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResultFormatter.java new file mode 100644 index 0000000000000000000000000000000000000000..08886e760f0bae6563e14acfbdc08db1177fca51 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResultFormatter.java @@ -0,0 +1,69 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.validation; + +import java.io.StringWriter; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * SPI which can be implemented to print out a summary of a validation result. See {@link + * ValidationResults#write(StringWriter, ValidationResultFormatter)} + * + * @author Daniel Meyer + * @since 7.6 + */ +public interface ValidationResultFormatter { + + /** + * formats an element in the summary + * + * @param writer the writer + * @param element the element to write + */ + void formatElement(StringWriter writer, ModelElementInstance element); + + /** + * formats a validation result + * + * @param writer the writer + * @param result the result to format + */ + void formatResult(StringWriter writer, ValidationResult result); + + /** + * formats a suffix with the count of omitted errors/warnings, to be used when writing with a + * maximum output size limit. See {@link ValidationResults#write(StringWriter, + * ValidationResultFormatter, int)} + * + * @param writer the writer + * @param count the count of results omitted from the writer output + */ + default void formatSuffixWithOmittedResultsCount(StringWriter writer, int count) { + // Do NOTHING by default + } + + /** + * returns the size of the formatted suffix (donating the count of omitted results) in bytes + * + * @param count the count of results to be omitted from the writer output + * @return the size of the formatted suffix in bytes + */ + default int getFormattedSuffixWithOmittedResultsSize(int count) { + return 0; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResultType.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResultType.java new file mode 100644 index 0000000000000000000000000000000000000000..76257b08e44bf8c9df1a8ad157b8af04698700c8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResultType.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.validation; + +/** + * @author Daniel Meyer + * + */ +public enum ValidationResultType { + + ERROR, + WARNING +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResults.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResults.java new file mode 100644 index 0000000000000000000000000000000000000000..956f55e88c0f753a9c0cf1e03f56060a0dd84833 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/main/java/org/camunda/bpm/model/xml/validation/ValidationResults.java @@ -0,0 +1,72 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.validation; + +import java.io.StringWriter; +import java.util.List; +import java.util.Map; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; + +/** + * Object in which the results of a model validation are collected. + * See: {@link ModelInstance#validate(java.util.Collection)}. + * + * @author Daniel Meyer + * @since 7.6 + */ +public interface ValidationResults { + + /** + * @return true if there are {@link ValidationResult} of type {@link ValidationResultType#ERROR} + */ + boolean hasErrors(); + + /** + * @return the count of {@link ValidationResult} of type {@link ValidationResultType#ERROR} + */ + int getErrorCount(); + + /** + * @return the count of {@link ValidationResult} of type {@link ValidationResultType#WARNING} + */ + int getWarinigCount(); + + /** + * @return the individual results of the validation grouped by element. + */ + Map> getResults(); + + /** + * Utility method to print out a summary of the validation results. + * + * @param writer a {@link StringWriter} to which the result should be printed + * @param formatter formatter for printing elements and validation results + */ + void write(StringWriter writer, ValidationResultFormatter formatter); + + /** + * Utility method to print out a summary of the validation results. + * + * @param writer a {@link StringWriter} to which the result should be printed + * @param formatter formatter for printing elements and validation results + * @param maxSize the maximum size (in bytes) that is allowed to be written to the writer + */ + void write(StringWriter writer, ValidationResultFormatter formatter, int maxSize); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/ModelTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/ModelTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b749c79aa1884e036a9ce6c9c4da55d84bb72a2a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/ModelTest.java @@ -0,0 +1,86 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml; + +import org.camunda.bpm.model.xml.testmodel.TestModel; +import org.camunda.bpm.model.xml.testmodel.instance.*; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.junit.Before; +import org.junit.Test; + +import java.util.Collection; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.*; + +/** + * @author Sebastian Menski + */ +public class ModelTest { + + private Model model; + + @Before + public void createModel() { + model = TestModel.getTestModel(); + } + + @Test + public void testGetTypes() { + Collection types = model.getTypes(); + assertThat(types).isNotEmpty(); + assertThat(types).contains( + model.getType(Animals.class), + model.getType(Animal.class), + model.getType(FlyingAnimal.class), + model.getType(Bird.class), + model.getType(RelationshipDefinition.class) + ); + } + + @Test + public void testGetType() { + ModelElementType flyingAnimalType = model.getType(FlyingAnimal.class); + assertThat(flyingAnimalType.getInstanceType()).isEqualTo(FlyingAnimal.class); + } + + @Test + public void testGetTypeForName() { + ModelElementType birdType = model.getTypeForName(ELEMENT_NAME_BIRD); + assertThat(birdType).isNull(); + birdType = model.getTypeForName(MODEL_NAMESPACE, ELEMENT_NAME_BIRD); + assertThat(birdType.getInstanceType()).isEqualTo(Bird.class); + } + + @Test + public void testGetModelName() { + assertThat(model.getModelName()).isEqualTo(MODEL_NAME); + } + + @Test + public void testEqual() { + assertThat(model).isNotEqualTo(null); + assertThat(model).isNotEqualTo(new Object()); + Model otherModel = ModelBuilder.createInstance("Other Model").build(); + assertThat(model).isNotEqualTo(otherModel); + otherModel = ModelBuilder.createInstance(MODEL_NAME).build(); + assertThat(model).isEqualTo(otherModel); + otherModel = ModelBuilder.createInstance(null).build(); + assertThat(otherModel).isNotEqualTo(model); + assertThat(model).isEqualTo(model); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/StringUtilTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/StringUtilTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2124de9d9379daf913db973a23051a1397e6564e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/StringUtilTest.java @@ -0,0 +1,80 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.bpm.model.xml.impl.util.StringUtil.joinCommaSeparatedList; +import static org.camunda.bpm.model.xml.impl.util.StringUtil.splitCommaSeparatedList; + +/** + * @author Sebastian Menski + */ +public class StringUtilTest { + + @Test + public void testStringListSplit() { + assertThat(splitCommaSeparatedList("")).isEmpty(); + assertThat(splitCommaSeparatedList(" ")).isEmpty(); + assertThat(splitCommaSeparatedList("a")).containsExactly("a"); + assertThat(splitCommaSeparatedList(" a ")).containsExactly("a"); + assertThat(splitCommaSeparatedList("a,b")).containsExactly("a", "b"); + assertThat(splitCommaSeparatedList("a , b, c ")).containsExactly("a", "b", "c"); + assertThat(splitCommaSeparatedList("${}")).containsExactly("${}"); + assertThat(splitCommaSeparatedList(" #{ } ")).containsExactly("#{ }"); + assertThat(splitCommaSeparatedList(" #{}, ${a}, #{b} ")).containsExactly("#{}", "${a}", "#{b}"); + assertThat(splitCommaSeparatedList(" a, ${b}, #{c} ")).containsExactly("a", "${b}", "#{c}"); + assertThat(splitCommaSeparatedList(" #{a}, b, ,c ,${d} ")).containsExactly("#{a}", "b", "c", "${d}"); + assertThat(splitCommaSeparatedList(" #{a(b,c)}, d, ,e ,${fg(h , i , j)} ")).containsExactly("#{a(b,c)}", "d", "e", "${fg(h , i , j)}"); + assertThat(splitCommaSeparatedList(" #{a == (b, c)}, d = e, f ,${fg(h , i , j)} ")).containsExactly("#{a == (b, c)}", "d = e", "f", "${fg(h , i , j)}"); + assertThat(splitCommaSeparatedList("accountancy, ${fakeLdapService.findManagers(execution, emp)}")).containsExactly("accountancy", "${fakeLdapService.findManagers(execution, emp)}"); + } + + @Test + public void testStringListJoin() { + assertThat(joinCommaSeparatedList(null)).isNull(); + List testList = new ArrayList(); + assertThat(joinCommaSeparatedList(testList)).isEqualTo(""); + testList.add("a"); + assertThat(joinCommaSeparatedList(testList)).isEqualTo("a"); + testList.add("b"); + assertThat(joinCommaSeparatedList(testList)).isEqualTo("a, b"); + testList.add("${a,b,c}"); + assertThat(joinCommaSeparatedList(testList)).isEqualTo("a, b, ${a,b,c}"); + testList.add("foo"); + assertThat(joinCommaSeparatedList(testList)).isEqualTo("a, b, ${a,b,c}, foo"); + testList.add("#{bar(e,f,g)}"); + assertThat(joinCommaSeparatedList(testList)).isEqualTo("a, b, ${a,b,c}, foo, #{bar(e,f,g)}"); + String testString = joinCommaSeparatedList(testList); + assertThat(splitCommaSeparatedList(testString)).containsAll(testList); + } + + @Test + public void testNullSplit() { + assertThat(splitCommaSeparatedList(null)).isEmpty(); + } + + @Test + public void testNullJoin() { + assertThat(joinCommaSeparatedList(null)).isNull(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/impl/parser/ParserTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/impl/parser/ParserTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6faa6cbf0e81d5f9e8be9601cb51d5de37613a52 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/impl/parser/ParserTest.java @@ -0,0 +1,124 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.impl.parser; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.InputStream; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.ModelParseException; +import org.camunda.bpm.model.xml.testmodel.TestModelParser; +import org.junit.Assume; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +public class ParserTest { + + private static final String ACCESS_EXTERNAL_SCHEMA_PROP = "javax.xml.accessExternalSchema"; + + @Rule + public ExpectedException exception = ExpectedException.none(); + + @Test + public void shouldThrowExceptionForTooManyAttributes() { + TestModelParser modelParser = new TestModelParser(); + String testXml = "org/camunda/bpm/model/xml/impl/parser/FeatureSecureProcessing.xml"; + InputStream testXmlAsStream = this.getClass().getClassLoader().getResourceAsStream(testXml); + try { + modelParser.parseModelFromStream(testXmlAsStream); + } catch (ModelParseException mpe) { + assertThat(mpe.getMessage()).isEqualTo("SAXException while parsing input stream"); + assertThat(mpe.getCause()).hasMessageContaining("JAXP00010002"); + } + } + + @Test + public void shouldProhibitExternalSchemaAccessViaSystemProperty() { + + // given + // the external schema access property is not supported on certain + // IBM JDK versions, in which case schema access cannot be restricted + Assume.assumeTrue(doesJdkSupportExternalSchemaAccessProperty()); + + System.setProperty(ACCESS_EXTERNAL_SCHEMA_PROP, ""); + + try { + TestModelParser modelParser = new TestModelParser(); + String testXml = "org/camunda/bpm/model/xml/impl/parser/ExternalSchemaAccess.xml"; + InputStream testXmlAsStream = this.getClass().getClassLoader().getResourceAsStream(testXml); + + // then + exception.expect(ModelParseException.class); + exception.expectMessage("SAXException while parsing input stream"); + + // when + modelParser.parseModelFromStream(testXmlAsStream); + } finally { + System.clearProperty(ACCESS_EXTERNAL_SCHEMA_PROP); + } + } + + @Test + public void shouldAllowExternalSchemaAccessViaSystemProperty() { + + // given + + System.setProperty(ACCESS_EXTERNAL_SCHEMA_PROP, "all"); + + try { + TestModelParser modelParser = new TestModelParser(); + String testXml = "org/camunda/bpm/model/xml/impl/parser/ExternalSchemaAccess.xml"; + InputStream testXmlAsStream = this.getClass().getClassLoader().getResourceAsStream(testXml); + + // when + ModelInstance modelInstance = modelParser.parseModelFromStream(testXmlAsStream); + + // then + assertThat(modelInstance).isNotNull(); + } finally { + System.clearProperty(ACCESS_EXTERNAL_SCHEMA_PROP); + } + } + + @Test + public void shouldThrowExceptionForDoctype() { + TestModelParser modelParser = new TestModelParser(); + String testXml = "org/camunda/bpm/model/xml/impl/parser/XxeProcessing.xml"; + InputStream testXmlAsStream = this.getClass().getClassLoader().getResourceAsStream(testXml); + try { + modelParser.parseModelFromStream(testXmlAsStream); + } catch (ModelParseException mpe) { + assertThat(mpe.getMessage()).isEqualTo("SAXException while parsing input stream"); + assertThat(mpe.getCause()).hasMessageContaining("DOCTYPE"); + assertThat(mpe.getCause()).hasMessageContaining("http://apache.org/xml/features/disallow-doctype-decl"); + } + } + + protected boolean doesJdkSupportExternalSchemaAccessProperty() { + String jvmVendor = System.getProperty("java.vm.vendor"); + String javaVersion = System.getProperty("java.version"); + + boolean isIbmJDK = jvmVendor != null && jvmVendor.contains("IBM"); + boolean isJava6or7 = javaVersion != null && (javaVersion.startsWith("1.6") || javaVersion.startsWith("1.7")); + + return !(isIbmJDK && isJava6or7); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/instance/DomTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/instance/DomTest.java new file mode 100644 index 0000000000000000000000000000000000000000..8851612f5fb641fcaf94c15878530e760b498c1a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/instance/DomTest.java @@ -0,0 +1,226 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.instance; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.parser.AbstractModelParser; +import org.camunda.bpm.model.xml.testmodel.Gender; +import org.camunda.bpm.model.xml.testmodel.TestModelParser; +import org.camunda.bpm.model.xml.testmodel.TestModelTest; +import org.camunda.bpm.model.xml.testmodel.instance.Animals; +import org.camunda.bpm.model.xml.testmodel.instance.Description; +import org.junit.Before; +import org.junit.Test; + +import java.util.Arrays; +import java.util.Collection; + +import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI; +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; +import static org.junit.runners.Parameterized.Parameters; + +/** + * @author Sebastian Menski + */ +public class DomTest extends TestModelTest { + + private static final String TEST_NS = "http://camunda.org/test"; + private static final String UNKNOWN_NS = "http://camunda.org/unknown"; + private static final String CAMUNDA_NS = "http://activiti.org/bpmn"; + private static final String FOX_NS = "http://www.camunda.com/fox"; + private static final String BPMN_NS = "http://www.omg.org/spec/BPMN/20100524/MODEL"; + + private DomDocument document; + + public DomTest(String testName, ModelInstance testModelInstance, AbstractModelParser modelParser) { + super(testName, testModelInstance, modelParser); + } + + @Parameters(name="Model {0}") + public static Collection models() { + return Arrays.asList( + createModel(), + parseModel(DomTest.class) + ); + } + + private static Object[] createModel() { + TestModelParser modelParser = new TestModelParser(); + ModelInstance modelInstance = modelParser.getEmptyModel(); + + Animals animals = modelInstance.newInstance(Animals.class); + modelInstance.setDocumentElement(animals); + + Description description = modelInstance.newInstance(Description.class); + description.getDomElement().addCDataSection("CDATA "); + animals.addChildElement(description); + + return new Object[]{"created", modelInstance, modelParser}; + } + + @Before + public void copyModelInstance() { + modelInstance = cloneModelInstance(); + document = modelInstance.getDocument(); + } + + @Test + public void testRegisterNamespaces() { + document.registerNamespace("test", TEST_NS); + String prefix = document.registerNamespace(UNKNOWN_NS); + assertThat(prefix).isEqualTo("ns0"); + + DomElement rootElement = document.getRootElement(); + assertThat(rootElement.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "test")).isTrue(); + assertThat(rootElement.getAttribute(XMLNS_ATTRIBUTE_NS_URI, "test")).isEqualTo(TEST_NS); + assertThat(rootElement.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns0")).isTrue(); + assertThat(rootElement.getAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns0")).isEqualTo(UNKNOWN_NS); + } + + @Test + public void testGenerateNamespacePrefixes() { + // occupy ns0 and ns2 + document.registerNamespace("ns0", UNKNOWN_NS + 0); + document.registerNamespace("ns2", UNKNOWN_NS + 2); + + // add two generate + String prefix = document.registerNamespace(UNKNOWN_NS + 1); + assertThat(prefix).isEqualTo("ns1"); + prefix = document.registerNamespace(UNKNOWN_NS + 3); + assertThat(prefix).isEqualTo("ns3"); + + DomElement rootElement = document.getRootElement(); + assertThat(rootElement.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns0")).isTrue(); + assertThat(rootElement.getAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns0")).isEqualTo(UNKNOWN_NS + 0); + assertThat(rootElement.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns1")).isTrue(); + assertThat(rootElement.getAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns1")).isEqualTo(UNKNOWN_NS + 1); + assertThat(rootElement.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns2")).isTrue(); + assertThat(rootElement.getAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns2")).isEqualTo(UNKNOWN_NS + 2); + assertThat(rootElement.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns3")).isTrue(); + assertThat(rootElement.getAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns3")).isEqualTo(UNKNOWN_NS + 3); + } + + @Test + public void testDuplicateNamespaces() { + document.registerNamespace("test", TEST_NS); + String prefix = document.registerNamespace(TEST_NS); + assertThat(prefix).isEqualTo("test"); + prefix = document.registerNamespace(UNKNOWN_NS); + assertThat(prefix).isEqualTo("ns0"); + prefix = document.registerNamespace(UNKNOWN_NS); + assertThat(prefix).isEqualTo("ns0"); + + DomElement rootElement = document.getRootElement(); + assertThat(rootElement.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "test")).isTrue(); + assertThat(rootElement.getAttribute(XMLNS_ATTRIBUTE_NS_URI, "test")).isEqualTo(TEST_NS); + assertThat(rootElement.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns0")).isTrue(); + assertThat(rootElement.getAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns0")).isEqualTo(UNKNOWN_NS); + assertThat(rootElement.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns1")).isFalse(); + } + + @Test + public void testKnownPrefix() { + document.registerNamespace(CAMUNDA_NS); + document.registerNamespace(FOX_NS); + + DomElement rootElement = document.getRootElement(); + assertThat(rootElement.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "camunda")).isTrue(); + assertThat(rootElement.getAttribute(XMLNS_ATTRIBUTE_NS_URI, "camunda")).isEqualTo(CAMUNDA_NS); + assertThat(rootElement.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "fox")).isTrue(); + assertThat(rootElement.getAttribute(XMLNS_ATTRIBUTE_NS_URI, "fox")).isEqualTo(FOX_NS); + } + + @Test + public void testAlreadyUsedPrefix() { + document.registerNamespace("camunda", TEST_NS); + document.registerNamespace(CAMUNDA_NS); + + DomElement rootElement = document.getRootElement(); + assertThat(rootElement.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "camunda")).isTrue(); + assertThat(rootElement.getAttribute(XMLNS_ATTRIBUTE_NS_URI, "camunda")).isEqualTo(TEST_NS); + assertThat(rootElement.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns0")).isTrue(); + assertThat(rootElement.getAttribute(XMLNS_ATTRIBUTE_NS_URI, "ns0")).isEqualTo(CAMUNDA_NS); + } + + @Test + public void testAddElements() { + DomElement element = document.createElement(MODEL_NAMESPACE, "bird"); + element.setAttribute(MODEL_NAMESPACE, "gender", Gender.Unknown.toString()); + document.getRootElement().appendChild(element); + assertThat(element.getNamespaceURI()).isEqualTo(MODEL_NAMESPACE); + assertThat(element.getLocalName()).isEqualTo("bird"); + assertThat(element.getPrefix()).isNull(); + assertThat(element.getDocument()).isEqualTo(document); + assertThat(element.getRootElement()).isEqualTo(document.getRootElement()); + + document.registerNamespace("test", TEST_NS); + element = document.createElement(TEST_NS, "dog"); + document.getRootElement().appendChild(element); + assertThat(element.getNamespaceURI()).isEqualTo(TEST_NS); + assertThat(element.getLocalName()).isEqualTo("dog"); + assertThat(element.getPrefix()).isEqualTo("test"); + assertThat(element.getDocument()).isEqualTo(document); + assertThat(element.getRootElement()).isEqualTo(document.getRootElement()); + + element = document.createElement(UNKNOWN_NS, "cat"); + document.getRootElement().appendChild(element); + assertThat(element.getNamespaceURI()).isEqualTo(UNKNOWN_NS); + assertThat(element.getLocalName()).isEqualTo("cat"); + assertThat(element.getPrefix()).isEqualTo("ns0"); + assertThat(element.getDocument()).isEqualTo(document); + assertThat(element.getRootElement()).isEqualTo(document.getRootElement()); + } + + @Test + public void testAddAttributes() { + DomElement element = document.createElement(MODEL_NAMESPACE, "bird"); + element.setAttribute(MODEL_NAMESPACE, "gender", Gender.Unknown.toString()); + document.getRootElement().appendChild(element); + element.setIdAttribute("id", "tweety"); + element.setAttribute(MODEL_NAMESPACE, "name", "Tweety"); + assertThat(element.getAttribute(MODEL_NAMESPACE, "id")).isEqualTo("tweety"); + assertThat(element.getAttribute("name")).isEqualTo("Tweety"); + + document.registerNamespace("test", TEST_NS); + element = document.createElement(TEST_NS, "dog"); + document.getRootElement().appendChild(element); + element.setIdAttribute("id", "snoopy"); + element.setAttribute(TEST_NS, "name", "Snoopy"); + assertThat(element.getAttribute(TEST_NS, "id")).isEqualTo("snoopy"); + assertThat(element.getAttribute("name")).isEqualTo("Snoopy"); + + element = document.createElement(UNKNOWN_NS, "cat"); + document.getRootElement().appendChild(element); + element.setIdAttribute("id", "sylvester"); + element.setAttribute(UNKNOWN_NS, "name", "Sylvester"); + element.setAttribute(BPMN_NS, "id", "test"); + assertThat(element.getAttribute(UNKNOWN_NS, "id")).isEqualTo("sylvester"); + assertThat(element.getAttribute("name")).isEqualTo("Sylvester"); + assertThat(element.getAttribute(BPMN_NS, "id")).isEqualTo("test"); + assertThat(element.hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "bpmn2")).isFalse(); + assertThat(document.getRootElement().hasAttribute(XMLNS_ATTRIBUTE_NS_URI, "bpmn2")).isTrue(); + } + + @Test + public void testCData() { + Animals animals = (Animals) modelInstance.getDocumentElement(); + assertThat(animals.getDescription().getTextContent()) + .isEqualTo("CDATA "); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/instance/ModelElementInstanceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/instance/ModelElementInstanceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..dce83d964b9a3a194efda2c30592b1467d32cb2f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/instance/ModelElementInstanceTest.java @@ -0,0 +1,188 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.instance; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.parser.AbstractModelParser; +import org.camunda.bpm.model.xml.testmodel.Gender; +import org.camunda.bpm.model.xml.testmodel.TestModelParser; +import org.camunda.bpm.model.xml.testmodel.TestModelTest; +import org.camunda.bpm.model.xml.testmodel.instance.Animals; +import org.camunda.bpm.model.xml.testmodel.instance.Bird; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.junit.Before; +import org.junit.Test; + +import java.util.Arrays; +import java.util.Collection; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; +import static org.junit.runners.Parameterized.Parameters; + +/** + * @author Daniel Meyer + * @author Sebastian Menski + */ +public class ModelElementInstanceTest extends TestModelTest { + + private Animals animals; + private Bird tweety; + private Bird donald; + private Bird daisy; + private Bird hedwig; + + public ModelElementInstanceTest(String testName, ModelInstance testModelInstance, AbstractModelParser modelParser) { + super(testName, testModelInstance, modelParser); + } + + @Parameters(name="Model {0}") + public static Collection models() { + Object[][] models = {createModel(), parseModel(ModelElementInstanceTest.class)}; + return Arrays.asList(models); + } + + private static Object[] createModel() { + TestModelParser modelParser = new TestModelParser(); + ModelInstance modelInstance = modelParser.getEmptyModel(); + + Animals animals = modelInstance.newInstance(Animals.class); + modelInstance.setDocumentElement(animals); + + createBird(modelInstance, "tweety", Gender.Female); + Bird donald = createBird(modelInstance, "donald", Gender.Male); + Bird daisy = createBird(modelInstance, "daisy", Gender.Female); + Bird hedwig = createBird(modelInstance, "hedwig", Gender.Male); + + donald.setTextContent("some text content"); + daisy.setTextContent("\n some text content with outer line breaks\n "); + hedwig.setTextContent("\n some text content with inner\n line breaks\n "); + + return new Object[]{"created", modelInstance, modelParser}; + } + + @Before + public void copyModelInstance() { + modelInstance = cloneModelInstance(); + + animals = (Animals) modelInstance.getDocumentElement(); + tweety = modelInstance.getModelElementById("tweety"); + donald = modelInstance.getModelElementById("donald"); + daisy = modelInstance.getModelElementById("daisy"); + hedwig = modelInstance.getModelElementById("hedwig"); + } + + @Test + public void testAttribute() { + String tweetyName = tweety.getId() + "-name"; + tweety.setAttributeValue("name", tweetyName); + assertThat(tweety.getAttributeValue("name")).isEqualTo(tweetyName); + tweety.removeAttribute("name"); + assertThat(tweety.getAttributeValue("name")).isNull(); + } + + @Test + public void testAttributeWithNamespace() { + String tweetyName = tweety.getId() + "-name"; + tweety.setAttributeValueNs(MODEL_NAMESPACE, "name", tweetyName); + assertThat(tweety.getAttributeValue("name")).isEqualTo(tweetyName); + assertThat(tweety.getAttributeValueNs(MODEL_NAMESPACE, "name")).isEqualTo(tweetyName); + tweety.removeAttributeNs(MODEL_NAMESPACE, "name"); + assertThat(tweety.getAttributeValue("name")).isNull(); + assertThat(tweety.getAttributeValueNs(MODEL_NAMESPACE, "name")).isNull(); + } + + @Test + public void TestElementType() { + ModelElementType birdType = modelInstance.getModel().getType(Bird.class); + assertThat(tweety.getElementType()).isEqualTo(birdType); + assertThat(donald.getElementType()).isEqualTo(birdType); + assertThat(daisy.getElementType()).isEqualTo(birdType); + assertThat(hedwig.getElementType()).isEqualTo(birdType); + } + + @Test + public void TestParentElement() { + assertThat(tweety.getParentElement()).isEqualTo(animals); + assertThat(donald.getParentElement()).isEqualTo(animals); + assertThat(daisy.getParentElement()).isEqualTo(animals); + assertThat(hedwig.getParentElement()).isEqualTo(animals); + + Bird timmy = modelInstance.newInstance(Bird.class); + timmy.setId("timmy"); + timmy.setGender(Gender.Male); + assertThat(timmy.getParentElement()).isNull(); + } + + @Test + public void TestModelInstance() { + assertThat(tweety.getModelInstance()).isEqualTo(modelInstance); + assertThat(donald.getModelInstance()).isEqualTo(modelInstance); + assertThat(daisy.getModelInstance()).isEqualTo(modelInstance); + assertThat(hedwig.getModelInstance()).isEqualTo(modelInstance); + } + + @Test + public void testReplaceWithElement() { + Bird timmy = modelInstance.newInstance(Bird.class); + timmy.setId("timmy"); + timmy.setGender(Gender.Male); + + assertThat(animals.getAnimals()) + .contains(tweety) + .doesNotContain(timmy); + + tweety.replaceWithElement(timmy); + + assertThat(animals.getAnimals()) + .contains(timmy) + .doesNotContain(tweety); + } + + @Test + public void testReplaceRootElement() { + assertThat(((Animals) modelInstance.getDocumentElement()).getAnimals()).isNotEmpty(); + Animals newAnimals = modelInstance.newInstance(Animals.class); + modelInstance.setDocumentElement(newAnimals); + assertThat(((Animals) modelInstance.getDocumentElement()).getAnimals()).isEmpty(); + } + + @Test + public void testTextContent() { + assertThat(tweety.getTextContent()).isEqualTo(""); + assertThat(donald.getTextContent()).isEqualTo("some text content"); + assertThat(daisy.getTextContent()).isEqualTo("some text content with outer line breaks"); + assertThat(hedwig.getTextContent()).isEqualTo("some text content with inner\n line breaks"); + + String testContent = "\n test content \n \n \t camunda.org \t \n "; + tweety.setTextContent(testContent); + assertThat(tweety.getTextContent()).isEqualTo(testContent.trim()); + } + + @Test + public void testRawTextContent() { + assertThat(tweety.getRawTextContent()).isEqualTo(""); + assertThat(donald.getRawTextContent()).isEqualTo("some text content"); + assertThat(daisy.getRawTextContent()).isEqualTo("\n some text content with outer line breaks\n "); + assertThat(hedwig.getRawTextContent()).isEqualTo("\n some text content with inner\n line breaks\n "); + + String testContent = "\n test content \n \n \t camunda.org \t \n "; + tweety.setTextContent(testContent); + assertThat(tweety.getRawTextContent()).isEqualTo(testContent); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/Gender.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/Gender.java new file mode 100644 index 0000000000000000000000000000000000000000..c1cac676b3ce10565de587f75d0c9c8799a79a5f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/Gender.java @@ -0,0 +1,26 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel; + +/** + * @author Sebastian Menski + */ +public enum Gender { + Unknown, + Male, + Female +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/ModelBuilderTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/ModelBuilderTest.java new file mode 100644 index 0000000000000000000000000000000000000000..fcd4dda2f826bcb8e6c07286a8177a8ad135cd95 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/ModelBuilderTest.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAME; + +/** + * @author Daniel Meyer + * + */ +public class ModelBuilderTest { + + @Test + public void shouldSetModelName() { + Model model = ModelBuilder.createInstance(MODEL_NAME) + .build(); + + assertThat(model.getModelName()).isEqualTo(MODEL_NAME); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModel.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModel.java new file mode 100644 index 0000000000000000000000000000000000000000..d6b0d309b2445c4e191d50cfc66376c18914ab68 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModel.java @@ -0,0 +1,69 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.testmodel.instance.*; + +/** + * @author Daniel Meyer + * + */ +public final class TestModel { + + private static Model model; + private static ModelBuilder modelBuilder; + + public static Model getTestModel() { + if(model == null) { + ModelBuilder modelBuilder = getModelBuilder(); + + Animals.registerType(modelBuilder); + Animal.registerType(modelBuilder); + AnimalReference.registerType(modelBuilder); + Bird.registerType(modelBuilder); + ChildRelationshipDefinition.registerType(modelBuilder); + Description.registerType(modelBuilder); + FlightPartnerRef.registerType(modelBuilder); + FlyingAnimal.registerType(modelBuilder); + Guardian.registerType(modelBuilder); + GuardEgg.registerType(modelBuilder); + Mother.registerType(modelBuilder); + SpouseRef.registerType(modelBuilder); + FriendRelationshipDefinition.registerType(modelBuilder); + RelationshipDefinition.registerType(modelBuilder); + RelationshipDefinitionRef.registerType(modelBuilder); + Egg.registerType(modelBuilder); + FlightInstructor.registerType(modelBuilder); + + Wings.registerType(modelBuilder); + + model = modelBuilder.build(); + } + + return model; + } + + public static ModelBuilder getModelBuilder() { + if (modelBuilder == null) { + modelBuilder = ModelBuilder.createInstance(TestModelConstants.MODEL_NAME); + } + return modelBuilder; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModelConstants.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModelConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..0f2935304af85b321cb98a40f9ada1d7b7b62778 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModelConstants.java @@ -0,0 +1,64 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel; + +/** + * @author Daniel Meyer + * + */ +public abstract class TestModelConstants { + + public static final String MODEL_NAME = "animals"; + public static final String MODEL_NAMESPACE = "http://camunda.org/animals"; + public static final String NEWER_NAMESPACE = "http://camunda.org/electronic"; + + public static final String TYPE_NAME_ANIMAL = "animal"; + public static final String TYPE_NAME_FLYING_ANIMAL = "flyingAnimal"; + public static final String TYPE_NAME_CHILD_RELATIONSHIP_DEFINITION = "childRelationshipDefinition"; + public static final String TYPE_NAME_FRIEND_RELATIONSHIP_DEFINITION = "friendRelationshipDefinition"; + public static final String TYPE_NAME_RELATIONSHIP_DEFINITION = "relationshipDefinition"; + public static final String TYPE_NAME_WINGS = "wings"; + + public static final String ELEMENT_NAME_ANIMALS = "animals"; + public static final String ELEMENT_NAME_BIRD = "bird"; + public static final String ELEMENT_NAME_RELATIONSHIP_DEFINITION_REF = "relationshipDefinitionRef"; + public static final String ELEMENT_NAME_FLIGHT_PARTNER_REF = "flightPartnerRef"; + public static final String ELEMENT_NAME_FLIGHT_INSTRUCTOR = "flightInstructor"; + public static final String ELEMENT_NAME_SPOUSE_REF = "spouseRef"; + public static final String ELEMENT_NAME_EGG = "egg"; + public static final String ELEMENT_NAME_ANIMAL_REFERENCE = "animalReference"; + public static final String ELEMENT_NAME_GUARDIAN = "guardian"; + public static final String ELEMENT_NAME_MOTHER = "mother"; + public static final String ELEMENT_NAME_GUARD_EGG = "guardEgg"; + public static final String ELEMENT_NAME_DESCRIPTION = "description"; + + public static final String ATTRIBUTE_NAME_ID = "id"; + public static final String ATTRIBUTE_NAME_NAME = "name"; + public static final String ATTRIBUTE_NAME_FATHER = "father"; + public static final String ATTRIBUTE_NAME_MOTHER = "mother"; + public static final String ATTRIBUTE_NAME_IS_ENDANGERED = "isEndangered"; + public static final String ATTRIBUTE_NAME_GENDER = "gender"; + public static final String ATTRIBUTE_NAME_AGE = "age"; + public static final String ATTRIBUTE_NAME_BEST_FRIEND_REFS = "bestFriendRefs"; + public static final String ATTRIBUTE_NAME_ANIMAL_REF = "animalRef"; + public static final String ATTRIBUTE_NAME_WINGSPAN = "wingspan"; + + private TestModelConstants() { + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModelInstanceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModelInstanceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0ce6a18c7a27cc3556c2f02706b90f38c7caa996 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModelInstanceTest.java @@ -0,0 +1,54 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.testmodel.instance.Animal; +import org.camunda.bpm.model.xml.testmodel.instance.Animals; +import org.camunda.bpm.model.xml.testmodel.instance.Bird; +import org.junit.Test; + +public class TestModelInstanceTest { + + @Test + public void testClone() throws Exception { + ModelInstance modelInstance = new TestModelParser().getEmptyModel(); + + Animals animals = modelInstance.newInstance(Animals.class); + modelInstance.setDocumentElement(animals); + + Animal animal = modelInstance.newInstance(Bird.class); + animal.setId("TestId"); + animals.addChildElement(animal); + + ModelInstance cloneInstance = modelInstance.clone(); + getFirstAnimal(cloneInstance).setId("TestId2"); + + assertThat(getFirstAnimal(modelInstance).getId(), is(equalTo("TestId"))); + assertThat(getFirstAnimal(cloneInstance).getId(), is(equalTo("TestId2"))); + } + + protected Animal getFirstAnimal(ModelInstance modelInstance) { + Animals animals = (Animals) modelInstance.getDocumentElement(); + return animals.getAnimals().iterator().next(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModelParser.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModelParser.java new file mode 100644 index 0000000000000000000000000000000000000000..364707a723465795be6b4064533cd805d2375d65 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModelParser.java @@ -0,0 +1,66 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.ModelValidationException; +import org.camunda.bpm.model.xml.impl.ModelImpl; +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.impl.parser.AbstractModelParser; +import org.camunda.bpm.model.xml.impl.util.ReflectUtil; +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.xml.sax.SAXException; + +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.validation.SchemaFactory; + +/** + * @author Daniel Meyer + * + */ +public class TestModelParser extends AbstractModelParser { + + private static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; + private static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; + + private static final String SCHEMA_LOCATION = "org/camunda/bpm/model/xml/testmodel/Testmodel.xsd"; + private static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; + + private static final String TEST_NS = "http://camunda.org/animals"; + + public TestModelParser() { + this.schemaFactory = SchemaFactory.newInstance(W3C_XML_SCHEMA); + try { + addSchema(TEST_NS, schemaFactory.newSchema(ReflectUtil.getResource(SCHEMA_LOCATION))); + } catch (SAXException e) { + throw new ModelValidationException("Unable to parse schema:" + ReflectUtil.getResource(SCHEMA_LOCATION), e); + } + } + + @Override + protected void configureFactory(DocumentBuilderFactory dbf) { + dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); + dbf.setAttribute(JAXP_SCHEMA_SOURCE, ReflectUtil.getResource(SCHEMA_LOCATION).toString()); + super.configureFactory(dbf); + } + + @Override + protected ModelInstance createModelInstance(DomDocument document) { + return new ModelInstanceImpl((ModelImpl) TestModel.getTestModel(), TestModel.getModelBuilder(), document); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModelTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModelTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1e0ddec08281c9564ae4519e699c74d782e5be1e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/TestModelTest.java @@ -0,0 +1,89 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.impl.parser.AbstractModelParser; +import org.camunda.bpm.model.xml.testmodel.instance.*; +import org.junit.After; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.io.InputStream; + +/** + * @author Sebastian Menski + */ +@RunWith(Parameterized.class) +public abstract class TestModelTest { + + protected final String testName; + private final ModelInstance testModelInstance; + private final AbstractModelParser modelParser; + + // cloned model instance for every test method (see subclasses) + protected ModelInstance modelInstance; + + public TestModelTest(String testName, ModelInstance testModelInstance, AbstractModelParser modelParser) { + this.testName = testName; + this.testModelInstance = testModelInstance; + this.modelParser = modelParser; + } + + public ModelInstance cloneModelInstance() { + return testModelInstance.clone(); + } + + protected static Object[] parseModel(Class test) { + TestModelParser modelParser = new TestModelParser(); + String testXml = test.getSimpleName() + ".xml"; + InputStream testXmlAsStream = test.getResourceAsStream(testXml); + ModelInstance modelInstance = modelParser.parseModelFromStream(testXmlAsStream); + return new Object[]{"parsed", modelInstance, modelParser}; + } + + public static Bird createBird(ModelInstance modelInstance, String id, Gender gender) { + Bird bird = modelInstance.newInstance(Bird.class, id); + bird.setGender(gender); + Animals animals = (Animals) modelInstance.getDocumentElement(); + animals.getAnimals().add(bird); + return bird; + } + + protected static RelationshipDefinition createRelationshipDefinition(ModelInstance modelInstance, Animal animalInRelationshipWith, Class relationshipDefinitionClass) { + RelationshipDefinition relationshipDefinition = modelInstance.newInstance(relationshipDefinitionClass, "relationship-" + animalInRelationshipWith.getId()); + relationshipDefinition.setAnimal(animalInRelationshipWith); + return relationshipDefinition; + } + + public static void addRelationshipDefinition(Animal animalWithRelationship, RelationshipDefinition relationshipDefinition) { + Animal animalInRelationshipWith = relationshipDefinition.getAnimal(); + relationshipDefinition.setId(animalWithRelationship.getId() + "-" + animalInRelationshipWith.getId()); + animalWithRelationship.getRelationshipDefinitions().add(relationshipDefinition); + } + + public static Egg createEgg(ModelInstance modelInstance, String id) { + Egg egg = modelInstance.newInstance(Egg.class, id); + return egg; + } + + @After + public void validateModel() { + modelParser.validateModel(modelInstance.getDocument()); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/AlternativeNsTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/AlternativeNsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..10e62e4123c6ffb7b4964da385b1996cd9fe12a7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/AlternativeNsTest.java @@ -0,0 +1,237 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.ModelImpl; +import org.camunda.bpm.model.xml.impl.parser.AbstractModelParser; +import org.camunda.bpm.model.xml.instance.DomElement; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.testmodel.Gender; +import org.camunda.bpm.model.xml.testmodel.TestModelConstants; +import org.camunda.bpm.model.xml.testmodel.TestModelTest; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runners.Parameterized.Parameters; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; + +/** + * @author Ronny Bräunlich + */ +public class AlternativeNsTest extends TestModelTest { + + private static final String MECHANICAL_NS = "http://camunda.org/mechanical"; + private static final String YET_ANOTHER_NS = "http://camunda.org/yans"; + + public AlternativeNsTest(String testName, ModelInstance testModelInstance, AbstractModelParser modelParser) { + super(testName, testModelInstance, modelParser); + } + + @Parameters(name = "Model {0}") + public static Collection models() { + return Collections.singleton(parseModel(AlternativeNsTest.class)); + } + + @Before + public void setUp() { + modelInstance = cloneModelInstance(); + ModelImpl modelImpl = (ModelImpl) modelInstance.getModel(); + modelImpl.declareAlternativeNamespace(MECHANICAL_NS, TestModelConstants.NEWER_NAMESPACE); + modelImpl.declareAlternativeNamespace(YET_ANOTHER_NS, TestModelConstants.NEWER_NAMESPACE); + } + + @After + public void tearDown() { + ModelImpl modelImpl = (ModelImpl) modelInstance.getModel(); + modelImpl.undeclareAlternativeNamespace(MECHANICAL_NS); + modelImpl.undeclareAlternativeNamespace(YET_ANOTHER_NS); + } + + @Test + public void getUniqueChildElementByNameNsForAlternativeNs() { + ModelElementInstance hedwig = modelInstance.getModelElementById("hedwig"); + assertThat(hedwig, is(notNullValue())); + ModelElementInstance childElementByNameNs = hedwig.getUniqueChildElementByNameNs(TestModelConstants.NEWER_NAMESPACE, "wings"); + assertThat(childElementByNameNs, is(notNullValue())); + assertThat(childElementByNameNs.getTextContent(), is("wusch")); + } + + @Test + public void getUniqueChildElementByNameNsForSecondAlternativeNs() { + // givne + ModelElementInstance donald = modelInstance.getModelElementById("donald"); + + // when + ModelElementInstance childElementByNameNs = donald.getUniqueChildElementByNameNs(TestModelConstants.NEWER_NAMESPACE, "wings"); + + // then + assertThat(childElementByNameNs, is(notNullValue())); + assertThat(childElementByNameNs.getTextContent(), is("flappy")); + } + + @Test + public void getChildElementsByTypeForAlternativeNs() { + ModelElementInstance birdo = modelInstance.getModelElementById("birdo"); + assertThat(birdo, is(notNullValue())); + Collection elements = birdo.getChildElementsByType(Wings.class); + assertThat(elements.size(), is(1)); + assertThat(elements.iterator().next().getTextContent(), is("zisch")); + } + + @Test + public void getChildElementsByTypeForSecondAlternativeNs() { + // given + ModelElementInstance donald = modelInstance.getModelElementById("donald"); + + // when + Collection elements = donald.getChildElementsByType(Wings.class); + + // then + assertThat(elements.size(), is(1)); + assertThat(elements.iterator().next().getTextContent(), is("flappy")); + } + + @Test + public void getAttributeValueNsForAlternativeNs() { + Bird plucky = modelInstance.getModelElementById("plucky"); + assertThat(plucky, is(notNullValue())); + Boolean extendedWings = plucky.canHazExtendedWings(); + assertThat(extendedWings, is(false)); + } + + @Test + public void getAttributeValueNsForSecondAlternativeNs() { + // given + Bird donald = modelInstance.getModelElementById("donald"); + + // when + Boolean extendedWings = donald.canHazExtendedWings(); + + // then + assertThat(extendedWings, is(true)); + } + + @Test + public void modifyingAttributeWithAlternativeNamespaceKeepsAlternativeNamespace(){ + Bird plucky = modelInstance.getModelElementById("plucky"); + assertThat(plucky, is(notNullValue())); + //validate old value + Boolean extendedWings = plucky.canHazExtendedWings(); + assertThat(extendedWings, is(false)); + //change it + plucky.setCanHazExtendedWings(true); + String attributeValueNs = plucky.getAttributeValueNs(MECHANICAL_NS, "canHazExtendedWings"); + assertThat(attributeValueNs, is("true")); + } + + @Test + public void modifyingAttributeWithSecondAlternativeNamespaceKeepsSecondAlternativeNamespace(){ + // given + Bird donald = modelInstance.getModelElementById("donald"); + + // when + donald.setCanHazExtendedWings(false); + + // then + String attributeValueNs = donald.getAttributeValueNs(YET_ANOTHER_NS, "canHazExtendedWings"); + assertThat(attributeValueNs, is("false")); + } + + @Test + public void modifyingAttributeWithNewNamespaceKeepsNewNamespace(){ + Bird bird = createBird(modelInstance, "waldo", Gender.Male); + bird.setCanHazExtendedWings(true); + String attributeValueNs = bird.getAttributeValueNs(TestModelConstants.NEWER_NAMESPACE, "canHazExtendedWings"); + assertThat(attributeValueNs, is("true")); + } + + @Test + public void modifyingElementWithAlternativeNamespaceKeepsAlternativeNamespace(){ + Bird birdo = modelInstance.getModelElementById("birdo"); + assertThat(birdo, is(notNullValue())); + Wings wings = birdo.getWings(); + assertThat(wings, is(notNullValue())); + wings.setTextContent("kawusch"); + + List childElementsByNameNs = birdo.getDomElement().getChildElementsByNameNs(MECHANICAL_NS, "wings"); + assertThat(childElementsByNameNs.size(), is(1)); + assertThat(childElementsByNameNs.get(0).getTextContent(), is("kawusch")); + } + + @Test + public void modifyingElementWithSecondAlternativeNamespaceKeepsSecondAlternativeNamespace(){ + // given + Bird donald = modelInstance.getModelElementById("donald"); + Wings wings = donald.getWings(); + + // when + wings.setTextContent("kawusch"); + + // then + List childElementsByNameNs = donald.getDomElement().getChildElementsByNameNs(YET_ANOTHER_NS, "wings"); + assertThat(childElementsByNameNs.size(), is(1)); + assertThat(childElementsByNameNs.get(0).getTextContent(), is("kawusch")); + } + + @Test + public void modifyingElementWithNewNamespaceKeepsNewNamespace(){ + Bird bird = createBird(modelInstance, "waldo", Gender.Male); + bird.setWings(modelInstance.newInstance(Wings.class)); + + List childElementsByNameNs = bird.getDomElement().getChildElementsByNameNs(TestModelConstants.NEWER_NAMESPACE, "wings"); + assertThat(childElementsByNameNs.size(), is(1)); + } + + @Test + public void useExistingNamespace() { + assertThatThereIsNoNewerNamespaceUrl(); + + Bird plucky = modelInstance.getModelElementById("plucky"); + plucky.setAttributeValueNs(MECHANICAL_NS, "canHazExtendedWings", "true"); + + Bird donald = modelInstance.getModelElementById("donald"); + donald.setAttributeValueNs(YET_ANOTHER_NS, "canHazExtendedWings", "false"); + assertThatThereIsNoNewerNamespaceUrl(); + + assertTrue(plucky.canHazExtendedWings()); + assertThatThereIsNoNewerNamespaceUrl(); + } + + protected void assertThatThereIsNoNewerNamespaceUrl() { + Node rootElement = modelInstance.getDocument().getDomSource().getNode().getFirstChild(); + NamedNodeMap attributes = rootElement.getAttributes(); + for (int i = 0; i < attributes.getLength(); i++) { + Node item = attributes.item(i); + String nodeValue = item.getNodeValue(); + assertNotEquals("Found newer namespace url which shouldn't exist", TestModelConstants.NEWER_NAMESPACE, nodeValue); + } + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Animal.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Animal.java new file mode 100644 index 0000000000000000000000000000000000000000..0dc6b9606defcaf00dc19fbed936ee87a2e649a8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Animal.java @@ -0,0 +1,185 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ATTRIBUTE_NAME_AGE; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ATTRIBUTE_NAME_BEST_FRIEND_REFS; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ATTRIBUTE_NAME_FATHER; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ATTRIBUTE_NAME_GENDER; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ATTRIBUTE_NAME_ID; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ATTRIBUTE_NAME_IS_ENDANGERED; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ATTRIBUTE_NAME_MOTHER; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ATTRIBUTE_NAME_NAME; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.TYPE_NAME_ANIMAL; + +import java.util.Collection; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.testmodel.Gender; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.AttributeReference; +import org.camunda.bpm.model.xml.type.reference.AttributeReferenceCollection; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollection; + +/** + * @author Daniel Meyer + * + */ +public abstract class Animal extends ModelElementInstanceImpl { + + protected static Attribute idAttr; + protected static Attribute nameAttr; + protected static AttributeReference fatherRef; + protected static AttributeReference motherRef; + protected static Attribute isEndangeredAttr; + protected static Attribute genderAttr; + protected static Attribute ageAttr; + protected static AttributeReferenceCollection bestFriendsRefCollection; + protected static ChildElementCollection relationshipDefinitionsColl; + protected static ElementReferenceCollection relationshipDefinitionRefsColl; + + public static void registerType(ModelBuilder modelBuilder) { + + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Animal.class, TYPE_NAME_ANIMAL) + .namespaceUri(MODEL_NAMESPACE) + .abstractType(); + + idAttr = typeBuilder.stringAttribute(ATTRIBUTE_NAME_ID) + .idAttribute() + .build(); + + nameAttr = typeBuilder.stringAttribute(ATTRIBUTE_NAME_NAME) + .build(); + + fatherRef = typeBuilder.stringAttribute(ATTRIBUTE_NAME_FATHER) + .qNameAttributeReference(Animal.class) + .build(); + + motherRef = typeBuilder.stringAttribute(ATTRIBUTE_NAME_MOTHER) + .idAttributeReference(Animal.class) + .build(); + + isEndangeredAttr = typeBuilder.booleanAttribute(ATTRIBUTE_NAME_IS_ENDANGERED) + .defaultValue(false) + .build(); + + genderAttr = typeBuilder.enumAttribute(ATTRIBUTE_NAME_GENDER, Gender.class) + .required() + .build(); + + ageAttr = typeBuilder.integerAttribute(ATTRIBUTE_NAME_AGE) + .build(); + + bestFriendsRefCollection = typeBuilder.stringAttribute(ATTRIBUTE_NAME_BEST_FRIEND_REFS) + .idAttributeReferenceCollection(Animal.class, AnimalAttributeReferenceCollection.class) + .build(); + + SequenceBuilder sequence = typeBuilder.sequence(); + + relationshipDefinitionsColl = sequence.elementCollection(RelationshipDefinition.class) + .build(); + + relationshipDefinitionRefsColl = sequence.elementCollection(RelationshipDefinitionRef.class) + .qNameElementReferenceCollection(RelationshipDefinition.class) + .build(); + + typeBuilder.build(); + } + + public Animal(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getId() { + return idAttr.getValue(this); + } + + public void setId(String id) { + idAttr.setValue(this, id); + } + + public String getName() { + return nameAttr.getValue(this); + } + + public void setName(String name) { + nameAttr.setValue(this, name); + } + + public Animal getFather() { + return fatherRef.getReferenceTargetElement(this); + } + + public void setFather(Animal father) { + fatherRef.setReferenceTargetElement(this, father); + } + + public Animal getMother() { + return motherRef.getReferenceTargetElement(this); + } + + public void setMother(Animal mother) { + motherRef.setReferenceTargetElement(this, mother); + } + + public Boolean isEndangered() { + return isEndangeredAttr.getValue(this); + } + + public void setIsEndangered(boolean isEndangered) { + isEndangeredAttr.setValue(this, isEndangered); + } + + public Gender getGender() { + return genderAttr.getValue(this); + } + + public void setGender(Gender gender) { + genderAttr.setValue(this, gender); + } + + public Integer getAge() { + return ageAttr.getValue(this); + } + + public void setAge(int age) { + ageAttr.setValue(this, age); + } + + public Collection getRelationshipDefinitions() { + return relationshipDefinitionsColl.get(this); + } + + public Collection getRelationshipDefinitionRefs() { + return relationshipDefinitionRefsColl.getReferenceTargetElements(this); + } + + public Collection getRelationshipDefinitionRefElements() { + return relationshipDefinitionRefsColl.getReferenceSourceCollection().get(this); + } + + public Collection getBestFriends() { + return bestFriendsRefCollection.getReferenceTargetElements(this); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/AnimalAttributeReferenceCollection.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/AnimalAttributeReferenceCollection.java new file mode 100644 index 0000000000000000000000000000000000000000..a1d13c7dee8cd1a0cab59bbfb46672cd3d32434a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/AnimalAttributeReferenceCollection.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl; +import org.camunda.bpm.model.xml.type.reference.AttributeReferenceCollection; + +/** + * @author Roman Smirnov + * @author Sebastian Menski + * + */ +public class AnimalAttributeReferenceCollection extends AttributeReferenceCollection { + + public AnimalAttributeReferenceCollection(AttributeImpl referenceSourceAttribute) { + super(referenceSourceAttribute); + } + + protected String getTargetElementIdentifier(Animal referenceTargetElement) { + return referenceTargetElement.getId(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/AnimalReference.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/AnimalReference.java new file mode 100644 index 0000000000000000000000000000000000000000..9f1930d5e68ef01e305d0a6ada94c83a47b1ddf1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/AnimalReference.java @@ -0,0 +1,61 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.*; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.testmodel.TestModelConstants; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; + +public class AnimalReference extends ModelElementInstanceImpl { + + protected static Attribute hrefAttribute; + + public AnimalReference(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getHref() { + return hrefAttribute.getValue(this); + } + + public void setHref(String href) { + hrefAttribute.setValue(this, href); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(AnimalReference.class, ELEMENT_NAME_ANIMAL_REFERENCE) + .namespaceUri(MODEL_NAMESPACE) + .instanceProvider(new ModelTypeInstanceProvider() { + public AnimalReference newInstance(ModelTypeInstanceContext instanceContext) { + return new AnimalReference(instanceContext); + } + }); + + hrefAttribute = typeBuilder.stringAttribute("href") + .required() + .build(); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/AnimalTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/AnimalTest.java new file mode 100644 index 0000000000000000000000000000000000000000..85f5d22403850b60dae6b9cc60d51e083e72ec8d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/AnimalTest.java @@ -0,0 +1,614 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.ModelValidationException; +import org.camunda.bpm.model.xml.impl.parser.AbstractModelParser; +import org.camunda.bpm.model.xml.testmodel.Gender; +import org.camunda.bpm.model.xml.testmodel.TestModelParser; +import org.camunda.bpm.model.xml.testmodel.TestModelTest; +import org.junit.Before; +import org.junit.Test; +import org.junit.runners.Parameterized.Parameters; + +/** + * @author Sebastian Menski + */ +public class AnimalTest extends TestModelTest { + + private Animal tweety; + private Animal hedwig; + private Animal birdo; + private Animal plucky; + private Animal fiffy; + private Animal timmy; + private Animal daisy; + private RelationshipDefinition hedwigRelationship; + private RelationshipDefinition birdoRelationship; + private RelationshipDefinition pluckyRelationship; + private RelationshipDefinition fiffyRelationship; + private RelationshipDefinition timmyRelationship; + private RelationshipDefinition daisyRelationship; + + public AnimalTest(String testName, ModelInstance testModelInstance, AbstractModelParser modelParser) { + super(testName, testModelInstance, modelParser); + } + + + @Parameters(name="Model {0}") + public static Collection models() { + Object[][] models = {createModel(), parseModel(AnimalTest.class)}; + return Arrays.asList(models); + } + + public static Object[] createModel() { + TestModelParser modelParser = new TestModelParser(); + ModelInstance modelInstance = modelParser.getEmptyModel(); + + Animals animals = modelInstance.newInstance(Animals.class); + modelInstance.setDocumentElement(animals); + + // add a tns namespace prefix for QName testing + animals.getDomElement().registerNamespace("tns", MODEL_NAMESPACE); + + Animal tweety = createBird(modelInstance, "tweety", Gender.Female); + Animal hedwig = createBird(modelInstance, "hedwig", Gender.Male); + Animal birdo = createBird(modelInstance, "birdo", Gender.Female); + Animal plucky = createBird(modelInstance, "plucky", Gender.Unknown); + Animal fiffy = createBird(modelInstance, "fiffy", Gender.Female); + createBird(modelInstance, "timmy", Gender.Male); + createBird(modelInstance, "daisy", Gender.Female); + + // create and add some relationships + RelationshipDefinition hedwigRelationship = createRelationshipDefinition(modelInstance, hedwig, ChildRelationshipDefinition.class); + addRelationshipDefinition(tweety, hedwigRelationship); + RelationshipDefinition birdoRelationship = createRelationshipDefinition(modelInstance, birdo, ChildRelationshipDefinition.class); + addRelationshipDefinition(tweety, birdoRelationship); + RelationshipDefinition pluckyRelationship = createRelationshipDefinition(modelInstance, plucky, FriendRelationshipDefinition.class); + addRelationshipDefinition(tweety, pluckyRelationship); + RelationshipDefinition fiffyRelationship = createRelationshipDefinition(modelInstance, fiffy, FriendRelationshipDefinition.class); + addRelationshipDefinition(tweety, fiffyRelationship); + + tweety.getRelationshipDefinitionRefs().add(hedwigRelationship); + tweety.getRelationshipDefinitionRefs().add(birdoRelationship); + tweety.getRelationshipDefinitionRefs().add(pluckyRelationship); + tweety.getRelationshipDefinitionRefs().add(fiffyRelationship); + + tweety.getBestFriends().add(birdo); + tweety.getBestFriends().add(plucky); + + return new Object[]{"created", modelInstance, modelParser}; + } + + @Before + public void copyModelInstance() { + modelInstance = cloneModelInstance(); + + tweety = modelInstance.getModelElementById("tweety"); + hedwig = modelInstance.getModelElementById("hedwig"); + birdo = modelInstance.getModelElementById("birdo"); + plucky = modelInstance.getModelElementById("plucky"); + fiffy = modelInstance.getModelElementById("fiffy"); + timmy = modelInstance.getModelElementById("timmy"); + daisy = modelInstance.getModelElementById("daisy"); + + hedwigRelationship = modelInstance.getModelElementById("tweety-hedwig"); + birdoRelationship = modelInstance.getModelElementById("tweety-birdo"); + pluckyRelationship = modelInstance.getModelElementById("tweety-plucky"); + fiffyRelationship = modelInstance.getModelElementById("tweety-fiffy"); + + timmyRelationship = createRelationshipDefinition(modelInstance, timmy, FriendRelationshipDefinition.class); + daisyRelationship = createRelationshipDefinition(modelInstance, daisy, ChildRelationshipDefinition.class); + } + + @Test + public void testSetIdAttributeByHelper() { + String newId = "new-" + tweety.getId(); + tweety.setId(newId); + assertThat(tweety.getId()).isEqualTo(newId); + } + + @Test + public void testSetIdAttributeByAttributeName() { + tweety.setAttributeValue("id", "duffy", true); + assertThat(tweety.getId()).isEqualTo("duffy"); + } + + @Test + public void testRemoveIdAttribute() { + tweety.removeAttribute("id"); + assertThat(tweety.getId()).isNull(); + } + + @Test + public void testSetNameAttributeByHelper() { + tweety.setName("tweety"); + assertThat(tweety.getName()).isEqualTo("tweety"); + } + + @Test + public void testSetNameAttributeByAttributeName() { + tweety.setAttributeValue("name", "daisy"); + assertThat(tweety.getName()).isEqualTo("daisy"); + } + + @Test + public void testRemoveNameAttribute() { + tweety.removeAttribute("name"); + assertThat(tweety.getName()).isNull(); + } + + @Test + public void testSetFatherAttributeByHelper() { + tweety.setFather(timmy); + assertThat(tweety.getFather()).isEqualTo(timmy); + } + + @Test + public void testSetFatherAttributeByAttributeName() { + tweety.setAttributeValue("father", timmy.getId()); + assertThat(tweety.getFather()).isEqualTo(timmy); + } + + @Test + public void testSetFatherAttributeByAttributeNameWithNamespace() { + tweety.setAttributeValue("father", "tns:hedwig"); + assertThat(tweety.getFather()).isEqualTo(hedwig); + } + + @Test + public void testRemoveFatherAttribute() { + tweety.setFather(timmy); + assertThat(tweety.getFather()).isEqualTo(timmy); + tweety.removeAttribute("father"); + assertThat(tweety.getFather()).isNull(); + } + + @Test + public void testChangeIdAttributeOfFatherReference() { + tweety.setFather(timmy); + assertThat(tweety.getFather()).isEqualTo(timmy); + timmy.setId("new-" + timmy.getId()); + assertThat(tweety.getFather()).isEqualTo(timmy); + } + + @Test + public void testReplaceFatherReferenceWithNewAnimal() { + tweety.setFather(timmy); + assertThat(tweety.getFather()).isEqualTo(timmy); + timmy.replaceWithElement(plucky); + assertThat(tweety.getFather()).isEqualTo(plucky); + } + + @Test + public void testSetMotherAttributeByHelper() { + tweety.setMother(daisy); + assertThat(tweety.getMother()).isEqualTo(daisy); + } + + @Test + public void testSetMotherAttributeByAttributeName() { + tweety.setAttributeValue("mother", fiffy.getId()); + assertThat(tweety.getMother()).isEqualTo(fiffy); + } + + @Test + public void testRemoveMotherAttribute() { + tweety.setMother(daisy); + assertThat(tweety.getMother()).isEqualTo(daisy); + tweety.removeAttribute("mother"); + assertThat(tweety.getMother()).isNull(); + } + + @Test + public void testReplaceMotherReferenceWithNewAnimal() { + tweety.setMother(daisy); + assertThat(tweety.getMother()).isEqualTo(daisy); + daisy.replaceWithElement(birdo); + assertThat(tweety.getMother()).isEqualTo(birdo); + } + + @Test + public void testChangeIdAttributeOfMotherReference() { + tweety.setMother(daisy); + assertThat(tweety.getMother()).isEqualTo(daisy); + daisy.setId("new-" + daisy.getId()); + assertThat(tweety.getMother()).isEqualTo(daisy); + } + + @Test + public void testSetIsEndangeredAttributeByHelper() { + tweety.setIsEndangered(true); + assertThat(tweety.isEndangered()).isTrue(); + } + + @Test + public void testSetIsEndangeredAttributeByAttributeName() { + tweety.setAttributeValue("isEndangered", "false"); + assertThat(tweety.isEndangered()).isFalse(); + } + + @Test + public void testRemoveIsEndangeredAttribute() { + tweety.removeAttribute("isEndangered"); + // default value of isEndangered: false + assertThat(tweety.isEndangered()).isFalse(); + } + + @Test + public void testSetGenderAttributeByHelper() { + tweety.setGender(Gender.Male); + assertThat(tweety.getGender()).isEqualTo(Gender.Male); + } + + @Test + public void testSetGenderAttributeByAttributeName() { + tweety.setAttributeValue("gender", Gender.Unknown.toString()); + assertThat(tweety.getGender()).isEqualTo(Gender.Unknown); + } + + @Test + public void testRemoveGenderAttribute() { + tweety.removeAttribute("gender"); + assertThat(tweety.getGender()).isNull(); + + // gender is required, so the model is invalid without + try { + validateModel(); + fail("The model is invalid cause the gender of an animal is a required attribute."); + } + catch (Exception e) { + assertThat(e).isInstanceOf(ModelValidationException.class); + } + + // add gender to make model valid + tweety.setGender(Gender.Female); + } + + @Test + public void testSetAgeAttributeByHelper() { + tweety.setAge(13); + assertThat(tweety.getAge()).isEqualTo(13); + } + + @Test + public void testSetAgeAttributeByAttributeName() { + tweety.setAttributeValue("age", "23"); + assertThat(tweety.getAge()).isEqualTo(23); + } + + @Test + public void testRemoveAgeAttribute() { + tweety.removeAttribute("age"); + assertThat(tweety.getAge()).isNull(); + } + + @Test + public void testAddRelationshipDefinitionsByHelper() { + assertThat(tweety.getRelationshipDefinitions()) + .isNotEmpty() + .hasSize(4) + .containsOnly(hedwigRelationship, birdoRelationship, pluckyRelationship, fiffyRelationship); + + tweety.getRelationshipDefinitions().add(timmyRelationship); + tweety.getRelationshipDefinitions().add(daisyRelationship); + + assertThat(tweety.getRelationshipDefinitions()) + .hasSize(6) + .containsOnly(hedwigRelationship, birdoRelationship, pluckyRelationship, fiffyRelationship, timmyRelationship, daisyRelationship); + } + + @Test + public void testUpdateRelationshipDefinitionsByIdByHelper() { + hedwigRelationship.setId("new-" + hedwigRelationship.getId()); + pluckyRelationship.setId("new-" + pluckyRelationship.getId()); + assertThat(tweety.getRelationshipDefinitions()) + .hasSize(4) + .containsOnly(hedwigRelationship, birdoRelationship, pluckyRelationship, fiffyRelationship); + } + + @Test + public void testUpdateRelationshipDefinitionsByIdByAttributeName() { + birdoRelationship.setAttributeValue("id", "new-" + birdoRelationship.getId(), true); + fiffyRelationship.setAttributeValue("id", "new-" + fiffyRelationship.getId(), true); + assertThat(tweety.getRelationshipDefinitions()) + .hasSize(4) + .containsOnly(hedwigRelationship, birdoRelationship, pluckyRelationship, fiffyRelationship); + } + + @Test + public void testUpdateRelationshipDefinitionsByReplaceElements() { + hedwigRelationship.replaceWithElement(timmyRelationship); + pluckyRelationship.replaceWithElement(daisyRelationship); + assertThat(tweety.getRelationshipDefinitions()) + .hasSize(4) + .containsOnly(birdoRelationship, fiffyRelationship, timmyRelationship, daisyRelationship); + } + + @Test + public void testUpdateRelationshipDefinitionsByRemoveElements() { + tweety.getRelationshipDefinitions().remove(birdoRelationship); + tweety.getRelationshipDefinitions().remove(fiffyRelationship); + assertThat(tweety.getRelationshipDefinitions()) + .hasSize(2) + .containsOnly(hedwigRelationship, pluckyRelationship); + } + + @Test + public void testClearRelationshipDefinitions() { + tweety.getRelationshipDefinitions().clear(); + assertThat(tweety.getRelationshipDefinitions()).isEmpty(); + } + + @Test + public void testAddRelationsDefinitionRefsByHelper() { + assertThat(tweety.getRelationshipDefinitionRefs()) + .isNotEmpty() + .hasSize(4) + .containsOnly(hedwigRelationship, birdoRelationship, pluckyRelationship, fiffyRelationship); + + addRelationshipDefinition(tweety, timmyRelationship); + addRelationshipDefinition(tweety, daisyRelationship); + tweety.getRelationshipDefinitionRefs().add(timmyRelationship); + tweety.getRelationshipDefinitionRefs().add(daisyRelationship); + + assertThat(tweety.getRelationshipDefinitionRefs()) + .isNotEmpty() + .hasSize(6) + .containsOnly(hedwigRelationship, birdoRelationship, pluckyRelationship, fiffyRelationship, timmyRelationship, daisyRelationship); + } + + @Test + public void testUpdateRelationshipDefinitionRefsByIdByHelper() { + hedwigRelationship.setId("child-relationship"); + pluckyRelationship.setId("friend-relationship"); + assertThat(tweety.getRelationshipDefinitionRefs()) + .hasSize(4) + .containsOnly(hedwigRelationship, birdoRelationship, pluckyRelationship, fiffyRelationship); + } + + @Test + public void testUpdateRelationshipDefinitionRefsByIdByAttributeName() { + birdoRelationship.setAttributeValue("id", "birdo-relationship", true); + fiffyRelationship.setAttributeValue("id", "fiffy-relationship", true); + assertThat(tweety.getRelationshipDefinitionRefs()) + .hasSize(4) + .containsOnly(hedwigRelationship, birdoRelationship, pluckyRelationship, fiffyRelationship); + } + + @Test + public void testUpdateRelationshipDefinitionRefsByReplaceElements() { + hedwigRelationship.replaceWithElement(timmyRelationship); + pluckyRelationship.replaceWithElement(daisyRelationship); + assertThat(tweety.getRelationshipDefinitionRefs()) + .hasSize(4) + .containsOnly(birdoRelationship, fiffyRelationship, timmyRelationship, daisyRelationship); + } + + @Test + public void testUpdateRelationshipDefinitionRefsByRemoveElements() { + tweety.getRelationshipDefinitions().remove(birdoRelationship); + tweety.getRelationshipDefinitions().remove(fiffyRelationship); + assertThat(tweety.getRelationshipDefinitionRefs()) + .hasSize(2) + .containsOnly(hedwigRelationship, pluckyRelationship); + } + + @Test + public void testUpdateRelationshipDefinitionRefsByRemoveIdAttribute() { + birdoRelationship.removeAttribute("id"); + pluckyRelationship.removeAttribute("id"); + assertThat(tweety.getRelationshipDefinitionRefs()) + .hasSize(2) + .containsOnly(hedwigRelationship, fiffyRelationship); + } + + @Test + public void testClearRelationshipDefinitionsRefs() { + tweety.getRelationshipDefinitionRefs().clear(); + assertThat(tweety.getRelationshipDefinitionRefs()).isEmpty(); + // should not affect animal relationship definitions + assertThat(tweety.getRelationshipDefinitions()).hasSize(4); + } + + @Test + public void testClearRelationshipDefinitionRefsByClearRelationshipDefinitions() { + assertThat(tweety.getRelationshipDefinitionRefs()).isNotEmpty(); + tweety.getRelationshipDefinitions().clear(); + assertThat(tweety.getRelationshipDefinitions()).isEmpty(); + // should affect animal relationship definition refs + assertThat(tweety.getRelationshipDefinitionRefs()).isEmpty(); + } + + @Test + public void testAddRelationshipDefinitionRefElementsByHelper() { + assertThat(tweety.getRelationshipDefinitionRefElements()) + .isNotEmpty() + .hasSize(4); + + addRelationshipDefinition(tweety, timmyRelationship); + RelationshipDefinitionRef timmyRelationshipDefinitionRef = modelInstance.newInstance(RelationshipDefinitionRef.class); + timmyRelationshipDefinitionRef.setTextContent(timmyRelationship.getId()); + tweety.getRelationshipDefinitionRefElements().add(timmyRelationshipDefinitionRef); + + addRelationshipDefinition(tweety, daisyRelationship); + RelationshipDefinitionRef daisyRelationshipDefinitionRef = modelInstance.newInstance(RelationshipDefinitionRef.class); + daisyRelationshipDefinitionRef.setTextContent(daisyRelationship.getId()); + tweety.getRelationshipDefinitionRefElements().add(daisyRelationshipDefinitionRef); + + assertThat(tweety.getRelationshipDefinitionRefElements()) + .isNotEmpty() + .hasSize(6) + .contains(timmyRelationshipDefinitionRef, daisyRelationshipDefinitionRef); + } + + @Test + public void testRelationshipDefinitionRefElementsByTextContent() { + Collection relationshipDefinitionRefElements = tweety.getRelationshipDefinitionRefElements(); + Collection textContents = new ArrayList(); + for (RelationshipDefinitionRef relationshipDefinitionRef : relationshipDefinitionRefElements) { + String textContent = relationshipDefinitionRef.getTextContent(); + assertThat(textContent).isNotEmpty(); + textContents.add(textContent); + } + assertThat(textContents) + .isNotEmpty() + .hasSize(4) + .containsOnly(hedwigRelationship.getId(), birdoRelationship.getId(), pluckyRelationship.getId(), fiffyRelationship.getId()); + } + + @Test + public void testUpdateRelationshipDefinitionRefElementsByTextContent() { + List relationshipDefinitionRefs = new ArrayList(tweety.getRelationshipDefinitionRefElements()); + + addRelationshipDefinition(tweety, timmyRelationship); + relationshipDefinitionRefs.get(0).setTextContent(timmyRelationship.getId()); + + addRelationshipDefinition(daisy, daisyRelationship); + relationshipDefinitionRefs.get(2).setTextContent(daisyRelationship.getId()); + + assertThat(tweety.getRelationshipDefinitionRefs()) + .hasSize(4) + .containsOnly(birdoRelationship, fiffyRelationship, timmyRelationship, daisyRelationship); + } + + @Test + public void testUpdateRelationshipDefinitionRefElementsByTextContentWithNamespace() { + List relationshipDefinitionRefs = new ArrayList(tweety.getRelationshipDefinitionRefElements()); + + addRelationshipDefinition(tweety, timmyRelationship); + relationshipDefinitionRefs.get(0).setTextContent("tns:" + timmyRelationship.getId()); + + addRelationshipDefinition(daisy, daisyRelationship); + relationshipDefinitionRefs.get(2).setTextContent("tns:" + daisyRelationship.getId()); + + assertThat(tweety.getRelationshipDefinitionRefs()) + .hasSize(4) + .containsOnly(birdoRelationship, fiffyRelationship, timmyRelationship, daisyRelationship); + } + + @Test + public void testUpdateRelationshipDefinitionRefElementsByRemoveElements() { + List relationshipDefinitionRefs = new ArrayList(tweety.getRelationshipDefinitionRefElements()); + tweety.getRelationshipDefinitionRefElements().remove(relationshipDefinitionRefs.get(1)); + tweety.getRelationshipDefinitionRefElements().remove(relationshipDefinitionRefs.get(3)); + assertThat(tweety.getRelationshipDefinitionRefs()) + .hasSize(2) + .containsOnly(hedwigRelationship, pluckyRelationship); + } + + @Test + public void testClearRelationshipDefinitionRefElements() { + tweety.getRelationshipDefinitionRefElements().clear(); + assertThat(tweety.getRelationshipDefinitionRefElements()).isEmpty(); + assertThat(tweety.getRelationshipDefinitionRefs()).isEmpty(); + // should not affect animal relationship definitions + assertThat(tweety.getRelationshipDefinitions()) + .isNotEmpty() + .hasSize(4); + } + + @Test + public void testClearRelationshipDefinitionRefElementsByClearRelationshipDefinitionRefs() { + tweety.getRelationshipDefinitionRefs().clear(); + assertThat(tweety.getRelationshipDefinitionRefs()).isEmpty(); + assertThat(tweety.getRelationshipDefinitionRefElements()).isEmpty(); + // should not affect animal relationship definitions + assertThat(tweety.getRelationshipDefinitions()) + .isNotEmpty() + .hasSize(4); + } + + @Test + public void testClearRelationshipDefinitionRefElementsByClearRelationshipDefinitions() { + tweety.getRelationshipDefinitions().clear(); + assertThat(tweety.getRelationshipDefinitionRefs()).isEmpty(); + assertThat(tweety.getRelationshipDefinitionRefElements()).isEmpty(); + // should affect animal relationship definitions + assertThat(tweety.getRelationshipDefinitions()).isEmpty(); + } + + @Test + public void testGetBestFriends() { + Collection bestFriends = tweety.getBestFriends(); + + assertThat(bestFriends) + .isNotEmpty() + .hasSize(2) + .containsOnly(birdo, plucky); + } + + @Test + public void testAddBestFriend() { + tweety.getBestFriends().add(daisy); + + Collection bestFriends = tweety.getBestFriends(); + + assertThat(bestFriends) + .isNotEmpty() + .hasSize(3) + .containsOnly(birdo, plucky, daisy); + } + + @Test + public void testRemoveBestFriendRef() { + tweety.getBestFriends().remove(plucky); + + Collection bestFriends = tweety.getBestFriends(); + + assertThat(bestFriends) + .isNotEmpty() + .hasSize(1) + .containsOnly(birdo); + } + + @Test + public void testClearBestFriendRef() { + tweety.getBestFriends().clear(); + + Collection bestFriends = tweety.getBestFriends(); + + assertThat(bestFriends) + .isEmpty(); + } + + @Test + public void testClearAndAddBestFriendRef() { + tweety.getBestFriends().clear(); + + Collection bestFriends = tweety.getBestFriends(); + + assertThat(bestFriends) + .isEmpty(); + + bestFriends.add(daisy); + + assertThat(bestFriends) + .hasSize(1) + .containsOnly(daisy); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Animals.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Animals.java new file mode 100644 index 0000000000000000000000000000000000000000..fc3cffd44242c71d9dae17d98a171b88d1579786 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Animals.java @@ -0,0 +1,80 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; + +import java.util.Collection; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ELEMENT_NAME_ANIMALS; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; + +/** + * @author Daniel Meyer + * + */ +public class Animals extends ModelElementInstanceImpl { + + protected static ChildElement descriptionChild; + protected static ChildElementCollection animalColl; + + public static void registerType(ModelBuilder modelBuilder) { + + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Animals.class, ELEMENT_NAME_ANIMALS) + .namespaceUri(MODEL_NAMESPACE) + .instanceProvider(new ModelTypeInstanceProvider() { + public Animals newInstance(ModelTypeInstanceContext instanceContext) { + return new Animals(instanceContext); + } + }); + + SequenceBuilder sequence = typeBuilder.sequence(); + + descriptionChild = sequence.element(Description.class) + .build(); + + animalColl = sequence.elementCollection(Animal.class) + .build(); + + typeBuilder.build(); + + } + + public Animals(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Description getDescription() { + return descriptionChild.getChild(this); + } + + public void setDescription(Description description) { + descriptionChild.setChild(this, description); + } + + public Collection getAnimals() { + return animalColl.get(this); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Bird.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Bird.java new file mode 100644 index 0000000000000000000000000000000000000000..f3a7ee37b9f1c600cc14670bcec9f6b0a9796fd0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Bird.java @@ -0,0 +1,132 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.testmodel.TestModelConstants; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.ChildElement; +import org.camunda.bpm.model.xml.type.child.ChildElementCollection; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReference; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollection; + +import java.util.Collection; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ELEMENT_NAME_BIRD; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; + +/** + * @author Daniel Meyer + * + */ +public class Bird extends FlyingAnimal { + + protected static ChildElementCollection eggColl; + protected static ElementReference spouseRefsColl; + protected static ElementReferenceCollection guardEggRefCollection; + protected static Attribute canHazExtendedWings; + protected static ChildElement wings; + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Bird.class, ELEMENT_NAME_BIRD) + .namespaceUri(MODEL_NAMESPACE) + .extendsType(FlyingAnimal.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Bird newInstance(ModelTypeInstanceContext instanceContext) { + return new Bird(instanceContext); + } + }); + + SequenceBuilder sequence = typeBuilder.sequence(); + + eggColl = sequence.elementCollection(Egg.class) + .minOccurs(0) + .maxOccurs(6) + .build(); + + spouseRefsColl = sequence.element(SpouseRef.class) + .qNameElementReference(Bird.class) + .build(); + + guardEggRefCollection = sequence.elementCollection(GuardEgg.class) + .idsElementReferenceCollection(Egg.class) + .build(); + + canHazExtendedWings = typeBuilder.booleanAttribute("canHazExtendedWings") + .namespace(TestModelConstants.NEWER_NAMESPACE) + .build(); + + wings = sequence.element(Wings.class) + .build(); + + typeBuilder.build(); + + } + + public Bird(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Collection getEggs() { + return eggColl.get(this); + } + + public Bird getSpouse() { + return spouseRefsColl.getReferenceTargetElement(this); + } + + public void setSpouse(Bird bird) { + spouseRefsColl.setReferenceTargetElement(this, bird); + } + + public void removeSpouse() { + spouseRefsColl.clearReferenceTargetElement(this); + } + + public SpouseRef getSpouseRef() { + return spouseRefsColl.getReferenceSource(this); + } + + public Collection getGuardedEggs() { + return guardEggRefCollection.getReferenceTargetElements(this); + } + + public Collection getGuardedEggRefs() { + return guardEggRefCollection.getReferenceSourceCollection().get(this); + } + + public Boolean canHazExtendedWings(){ + return canHazExtendedWings.getValue(this); + } + + public void setCanHazExtendedWings(boolean b){ + canHazExtendedWings.setValue(this, b); + } + + public Wings getWings(){ + return wings.getChild(this); + } + + public void setWings(Wings w){ + wings.setChild(this, w); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/BirdTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/BirdTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f9f0da8981df158383d1e0e3bd9fa074de19ed9a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/BirdTest.java @@ -0,0 +1,460 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.parser.AbstractModelParser; +import org.camunda.bpm.model.xml.impl.util.StringUtil; +import org.camunda.bpm.model.xml.testmodel.Gender; +import org.camunda.bpm.model.xml.testmodel.TestModelParser; +import org.camunda.bpm.model.xml.testmodel.TestModelTest; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; +import static org.junit.runners.Parameterized.Parameters; + +/** + * @author Sebastian Menski + */ +public class BirdTest extends TestModelTest { + + private Bird tweety; + private Bird hedwig; + private Bird timmy; + private Egg egg1; + private Egg egg2; + private Egg egg3; + + public BirdTest(String testName, ModelInstance testModelInstance, AbstractModelParser modelParser) { + super(testName, testModelInstance, modelParser); + } + + @Parameters(name="Model {0}") + public static Collection models() { + Object[][] models = {createModel(), parseModel(BirdTest.class)}; + return Arrays.asList(models); + } + + public static Object[] createModel() { + TestModelParser modelParser = new TestModelParser(); + ModelInstance modelInstance = modelParser.getEmptyModel(); + + Animals animals = modelInstance.newInstance(Animals.class); + modelInstance.setDocumentElement(animals); + + // add a tns namespace prefix for QName testing + animals.getDomElement().registerNamespace("tns", MODEL_NAMESPACE); + + Bird tweety = createBird(modelInstance, "tweety", Gender.Female); + Bird hedwig = createBird(modelInstance, "hedwig", Gender.Female); + Bird timmy = createBird(modelInstance, "timmy", Gender.Female); + Egg egg1 = createEgg(modelInstance, "egg1"); + egg1.setMother(tweety); + Collection guards = egg1.getGuardians(); + guards.add(hedwig); + guards.add(timmy); + Egg egg2 = createEgg(modelInstance, "egg2"); + egg2.setMother(tweety); + guards = egg2.getGuardians(); + guards.add(hedwig); + guards.add(timmy); + Egg egg3 = createEgg(modelInstance, "egg3"); + guards = egg3.getGuardians(); + guards.add(timmy); + + tweety.setSpouse(hedwig); + tweety.getEggs().add(egg1); + tweety.getEggs().add(egg2); + tweety.getEggs().add(egg3); + + Collection guardedEggs = hedwig.getGuardedEggs(); + guardedEggs.add(egg1); + guardedEggs.add(egg2); + + GuardEgg guardEgg = modelInstance.newInstance(GuardEgg.class); + guardEgg.setTextContent(egg1.getId() + " " + egg2.getId()); + timmy.getGuardedEggRefs().add(guardEgg); + timmy.getGuardedEggs().add(egg3); + + return new Object[]{"created", modelInstance, modelParser}; + } + + @Before + public void copyModelInstance() { + modelInstance = cloneModelInstance(); + tweety = modelInstance.getModelElementById("tweety"); + hedwig = modelInstance.getModelElementById("hedwig"); + timmy = modelInstance.getModelElementById("timmy"); + egg1 = modelInstance.getModelElementById("egg1"); + egg2 = modelInstance.getModelElementById("egg2"); + egg3 = modelInstance.getModelElementById("egg3"); + } + + @Test + public void testAddEggsByHelper() { + assertThat(tweety.getEggs()) + .isNotEmpty() + .hasSize(3) + .containsOnly(egg1, egg2, egg3); + + Egg egg4 = createEgg(modelInstance, "egg4"); + tweety.getEggs().add(egg4); + Egg egg5 = createEgg(modelInstance, "egg5"); + tweety.getEggs().add(egg5); + + assertThat(tweety.getEggs()) + .hasSize(5) + .containsOnly(egg1, egg2, egg3, egg4, egg5); + } + + @Test + public void testUpdateEggsByIdByHelper() { + egg1.setId("new-" + egg1.getId()); + egg2.setId("new-" + egg2.getId()); + assertThat(tweety.getEggs()) + .hasSize(3) + .containsOnly(egg1, egg2, egg3); + } + + @Test + public void testUpdateEggsByIdByAttributeName() { + egg1.setAttributeValue("id", "new-" + egg1.getId(), true); + egg2.setAttributeValue("id", "new-" + egg2.getId(), true); + assertThat(tweety.getEggs()) + .hasSize(3) + .containsOnly(egg1, egg2, egg3); + } + + @Test + public void testUpdateEggsByReplaceElements() { + Egg egg4 = createEgg(modelInstance, "egg4"); + Egg egg5 = createEgg(modelInstance, "egg5"); + egg1.replaceWithElement(egg4); + egg2.replaceWithElement(egg5); + assertThat(tweety.getEggs()) + .hasSize(3) + .containsOnly(egg3, egg4, egg5); + } + + @Test + public void testUpdateEggsByRemoveElement() { + tweety.getEggs().remove(egg1); + assertThat(tweety.getEggs()) + .hasSize(2) + .containsOnly(egg2, egg3); + } + + @Test + public void testClearEggs() { + tweety.getEggs().clear(); + assertThat(tweety.getEggs()) + .isEmpty(); + } + + @Test + public void testSetSpouseRefByHelper() { + tweety.setSpouse(timmy); + assertThat(tweety.getSpouse()).isEqualTo(timmy); + } + + @Test + public void testUpdateSpouseByIdHelper() { + hedwig.setId("new-" + hedwig.getId()); + assertThat(tweety.getSpouse()).isEqualTo(hedwig); + } + + @Test + public void testUpdateSpouseByIdByAttributeName() { + hedwig.setAttributeValue("id", "new-" + hedwig.getId(), true); + assertThat(tweety.getSpouse()).isEqualTo(hedwig); + } + + @Test + public void testUpdateSpouseByReplaceElement() { + hedwig.replaceWithElement(timmy); + assertThat(tweety.getSpouse()).isEqualTo(timmy); + } + + @Test + public void testUpdateSpouseByRemoveElement() { + Animals animals = (Animals) modelInstance.getDocumentElement(); + animals.getAnimals().remove(hedwig); + assertThat(tweety.getSpouse()).isNull(); + } + + @Test + public void testClearSpouse() { + tweety.removeSpouse(); + assertThat(tweety.getSpouse()).isNull(); + } + + @Test + public void testSetSpouseRefsByHelper() { + SpouseRef spouseRef = modelInstance.newInstance(SpouseRef.class); + spouseRef.setTextContent(timmy.getId()); + tweety.getSpouseRef().replaceWithElement(spouseRef); + assertThat(tweety.getSpouse()).isEqualTo(timmy); + } + + @Test + public void testSpouseRefsByTextContent() { + SpouseRef spouseRef = tweety.getSpouseRef(); + assertThat(spouseRef.getTextContent()).isEqualTo(hedwig.getId()); + } + + @Test + public void testUpdateSpouseRefsByTextContent() { + SpouseRef spouseRef = tweety.getSpouseRef(); + spouseRef.setTextContent(timmy.getId()); + assertThat(tweety.getSpouse()).isEqualTo(timmy); + } + + @Test + public void testUpdateSpouseRefsByTextContentWithNamespace() { + SpouseRef spouseRef = tweety.getSpouseRef(); + spouseRef.setTextContent("tns:" + timmy.getId()); + assertThat(tweety.getSpouse()).isEqualTo(timmy); + } + + @Test + public void testGetMother() { + Animal mother = egg1.getMother(); + assertThat(mother).isEqualTo(tweety); + + mother = egg2.getMother(); + assertThat(mother).isEqualTo(tweety); + } + + @Test + public void testSetMotherRefByHelper() { + egg1.setMother(timmy); + assertThat(egg1.getMother()).isEqualTo(timmy); + } + + @Test + public void testUpdateMotherByIdHelper() { + tweety.setId("new-" + tweety.getId()); + assertThat(egg1.getMother()).isEqualTo(tweety); + } + + @Test + public void testUpdateMotherByIdByAttributeName() { + tweety.setAttributeValue("id", "new-" + tweety.getId(), true); + assertThat(egg1.getMother()).isEqualTo(tweety); + } + + @Test + public void testUpdateMotherByReplaceElement() { + tweety.replaceWithElement(timmy); + assertThat(egg1.getMother()).isEqualTo(timmy); + } + + @Test + public void testUpdateMotherByRemoveElement() { + egg1.setMother(hedwig); + Animals animals = (Animals) modelInstance.getDocumentElement(); + animals.getAnimals().remove(hedwig); + assertThat(egg1.getMother()).isNull(); + } + + @Test + public void testClearMother() { + egg1.removeMother(); + assertThat(egg1.getMother()).isNull(); + } + + @Test + public void testSetMotherRefsByHelper() { + Mother mother = modelInstance.newInstance(Mother.class); + mother.setHref("#" + timmy.getId()); + egg1.getMotherRef().replaceWithElement(mother); + assertThat(egg1.getMother()).isEqualTo(timmy); + } + + @Test + public void testMotherRefsByTextContent() { + Mother mother = egg1.getMotherRef(); + assertThat(mother.getHref()).isEqualTo("#" + tweety.getId()); + } + + @Test + public void testUpdateMotherRefsByTextContent() { + Mother mother = egg1.getMotherRef(); + mother.setHref("#" + timmy.getId()); + assertThat(egg1.getMother()).isEqualTo(timmy); + } + + @Test + public void testGetGuards() { + Collection guards = egg1.getGuardians(); + assertThat(guards).isNotEmpty().hasSize(2); + assertThat(guards).contains(hedwig, timmy); + + guards = egg2.getGuardians(); + assertThat(guards).isNotEmpty().hasSize(2); + assertThat(guards).contains(hedwig, timmy); + } + + @Test + public void testAddGuardianRefsByHelper() { + assertThat(egg1.getGuardianRefs()) + .isNotEmpty() + .hasSize(2); + + Guardian tweetyGuardian = modelInstance.newInstance(Guardian.class); + tweetyGuardian.setHref("#" + tweety.getId()); + egg1.getGuardianRefs().add(tweetyGuardian); + + assertThat(egg1.getGuardianRefs()) + .isNotEmpty() + .hasSize(3) + .contains(tweetyGuardian); + } + + @Test + public void testGuardianRefsByTextContent() { + Collection guardianRefs = egg1.getGuardianRefs(); + Collection hrefs = new ArrayList(); + for (Guardian guardianRef : guardianRefs) { + String href = guardianRef.getHref(); + assertThat(href).isNotEmpty(); + hrefs.add(href); + } + assertThat(hrefs) + .isNotEmpty() + .hasSize(2) + .containsOnly("#" + hedwig.getId(), "#" + timmy.getId()); + } + + @Test + public void testUpdateGuardianRefsByTextContent() { + List guardianRefs = new ArrayList(egg1.getGuardianRefs()); + + guardianRefs.get(0).setHref("#" + tweety.getId()); + + assertThat(egg1.getGuardians()) + .hasSize(2) + .containsOnly(tweety, timmy); + } + + @Test + public void testUpdateGuardianRefsByRemoveElements() { + List guardianRefs = new ArrayList(egg1.getGuardianRefs()); + egg1.getGuardianRefs().remove(guardianRefs.get(1)); + assertThat(egg1.getGuardians()) + .hasSize(1) + .containsOnly(hedwig); + } + + @Test + public void testClearGuardianRefs() { + egg1.getGuardianRefs().clear(); + assertThat(egg1.getGuardianRefs()).isEmpty(); + + // should not affect animals collection + Animals animals = (Animals) modelInstance.getDocumentElement(); + assertThat(animals.getAnimals()) + .isNotEmpty() + .hasSize(3); + } + + @Test + public void testGetGuardedEggs() { + Collection guardedEggs = hedwig.getGuardedEggs(); + assertThat(guardedEggs) + .isNotEmpty() + .hasSize(2) + .contains(egg1, egg2); + + guardedEggs = timmy.getGuardedEggs(); + assertThat(guardedEggs) + .isNotEmpty() + .hasSize(3) + .contains(egg1, egg2); + } + + @Test + public void testAddGuardedEggRefsByHelper() { + assertThat(hedwig.getGuardedEggRefs()) + .isNotEmpty() + .hasSize(2); + + GuardEgg egg3GuardedEgg = modelInstance.newInstance(GuardEgg.class); + egg3GuardedEgg.setTextContent(egg3.getId()); + hedwig.getGuardedEggRefs().add(egg3GuardedEgg); + + assertThat(hedwig.getGuardedEggRefs()) + .isNotEmpty() + .hasSize(3) + .contains(egg3GuardedEgg); + } + + @Test + public void testGuardedEggRefsByTextContent() { + Collection guardianRefs = timmy.getGuardedEggRefs(); + Collection textContents = new ArrayList(); + for (GuardEgg guardianRef : guardianRefs) { + String textContent = guardianRef.getTextContent(); + assertThat(textContent).isNotEmpty(); + textContents.addAll(StringUtil.splitListBySeparator(textContent, " ")); + } + assertThat(textContents) + .isNotEmpty() + .hasSize(3) + .containsOnly(egg1.getId(), egg2.getId(), egg3.getId()); + } + + @Test + public void testUpdateGuardedEggRefsByTextContent() { + List guardianRefs = new ArrayList(hedwig.getGuardedEggRefs()); + + guardianRefs.get(0).setTextContent(egg1.getId() + " " + egg3.getId()); + + assertThat(hedwig.getGuardedEggs()) + .hasSize(3) + .containsOnly(egg1, egg2, egg3); + } + + @Test + public void testUpdateGuardedEggRefsByRemoveElements() { + List guardianRefs = new ArrayList(timmy.getGuardedEggRefs()); + timmy.getGuardedEggRefs().remove(guardianRefs.get(0)); + assertThat(timmy.getGuardedEggs()) + .hasSize(1) + .containsOnly(egg3); + } + + @Test + public void testClearGuardedEggRefs() { + timmy.getGuardedEggRefs().clear(); + assertThat(timmy.getGuardedEggRefs()).isEmpty(); + + // should not affect animals collection + Animals animals = (Animals) modelInstance.getDocumentElement(); + assertThat(animals.getAnimals()) + .isNotEmpty() + .hasSize(3); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/ChildRelationshipDefinition.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/ChildRelationshipDefinition.java new file mode 100644 index 0000000000000000000000000000000000000000..09204ad6e26e24f4433c6bdc1f0041122e8b8d4f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/ChildRelationshipDefinition.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.TYPE_NAME_CHILD_RELATIONSHIP_DEFINITION; + +/** + * @author Sebastian Menski + */ +public class ChildRelationshipDefinition extends RelationshipDefinition { + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ChildRelationshipDefinition.class, TYPE_NAME_CHILD_RELATIONSHIP_DEFINITION) + .namespaceUri(MODEL_NAMESPACE) + .extendsType(RelationshipDefinition.class) + .instanceProvider(new ModelTypeInstanceProvider() { + + public ChildRelationshipDefinition newInstance(ModelTypeInstanceContext instanceContext) { + return new ChildRelationshipDefinition(instanceContext); + } + }); + + typeBuilder.build(); + } + + public ChildRelationshipDefinition(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Description.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Description.java new file mode 100644 index 0000000000000000000000000000000000000000..81847e37b839ef3d85ad694f1e6048db032791ce --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Description.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.testmodel.TestModelConstants; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.*; + +public class Description extends ModelElementInstanceImpl { + + public Description(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Description.class, ELEMENT_NAME_DESCRIPTION) + .namespaceUri(MODEL_NAMESPACE) + .instanceProvider(new ModelTypeInstanceProvider() { + public Description newInstance(ModelTypeInstanceContext instanceContext) { + return new Description(instanceContext); + } + }); + + typeBuilder.build(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Egg.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Egg.java new file mode 100644 index 0000000000000000000000000000000000000000..e89740ff1fbf360a4d520909bba6dff78c26102b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Egg.java @@ -0,0 +1,103 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReference; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollection; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.*; + +import java.util.Collection; + +/** + * @author Sebastian Menski + */ +public class Egg extends ModelElementInstanceImpl { + + protected static Attribute idAttr; + protected static ElementReference motherRefChild; + protected static ElementReferenceCollection guardianRefCollection; + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Egg.class, ELEMENT_NAME_EGG) + .namespaceUri(MODEL_NAMESPACE) + .instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider() { + public Egg newInstance(ModelTypeInstanceContext instanceContext) { + return new Egg(instanceContext); + } + }); + + idAttr = typeBuilder.stringAttribute(ATTRIBUTE_NAME_ID) + .idAttribute() + .build(); + + SequenceBuilder sequenceBuilder = typeBuilder.sequence(); + + motherRefChild = sequenceBuilder.element(Mother.class) + .uriElementReference(Animal.class) + .build(); + + guardianRefCollection = sequenceBuilder.elementCollection(Guardian.class) + .uriElementReferenceCollection(Animal.class) + .build(); + + typeBuilder.build(); + } + + public Egg(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getId() { + return idAttr.getValue(this); + } + + public void setId(String id) { + idAttr.setValue(this, id); + } + + public Animal getMother() { + return motherRefChild.getReferenceTargetElement(this); + } + + public void removeMother() { + motherRefChild.clearReferenceTargetElement(this); + } + + public void setMother(Animal mother) { + motherRefChild.setReferenceTargetElement(this, mother); + } + + public Mother getMotherRef() { + return motherRefChild.getReferenceSource(this); + } + + public Collection getGuardians() { + return guardianRefCollection.getReferenceTargetElements(this); + } + + public Collection getGuardianRefs() { + return guardianRefCollection.getReferenceSourceCollection().get(this); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FlightInstructor.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FlightInstructor.java new file mode 100644 index 0000000000000000000000000000000000000000..dd8e845fb0ce2136ece9a034e60c2af33d677e84 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FlightInstructor.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ELEMENT_NAME_FLIGHT_INSTRUCTOR; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; +import static org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +/** + * @author Sebastian Menski + */ +public class FlightInstructor extends ModelElementInstanceImpl { + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(FlightInstructor.class, ELEMENT_NAME_FLIGHT_INSTRUCTOR) + .namespaceUri(MODEL_NAMESPACE) + .instanceProvider(new ModelTypeInstanceProvider() { + public FlightInstructor newInstance(ModelTypeInstanceContext instanceContext) { + return new FlightInstructor(instanceContext); + } + }); + + typeBuilder.build(); + } + + public FlightInstructor(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FlightPartnerRef.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FlightPartnerRef.java new file mode 100644 index 0000000000000000000000000000000000000000..b5d9fe48495f88a5fc169451bdd0171eb4e3a6cc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FlightPartnerRef.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ELEMENT_NAME_FLIGHT_PARTNER_REF; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; +import static org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +/** + * @author Sebastian Menski + */ +public class FlightPartnerRef extends ModelElementInstanceImpl { + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(FlightPartnerRef.class, ELEMENT_NAME_FLIGHT_PARTNER_REF) + .namespaceUri(MODEL_NAMESPACE) + .instanceProvider(new ModelTypeInstanceProvider() { + public FlightPartnerRef newInstance(ModelTypeInstanceContext instanceContext) { + return new FlightPartnerRef(instanceContext); + } + }); + + typeBuilder.build(); + } + + public FlightPartnerRef(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FlyingAnimal.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FlyingAnimal.java new file mode 100644 index 0000000000000000000000000000000000000000..da41e786c4a2ca66d5b2b29d184d105c7c840144 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FlyingAnimal.java @@ -0,0 +1,97 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.child.SequenceBuilder; +import org.camunda.bpm.model.xml.type.reference.ElementReference; +import org.camunda.bpm.model.xml.type.reference.ElementReferenceCollection; + +import java.util.Collection; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.*; + +/** + * @author Daniel Meyer + * + */ +public abstract class FlyingAnimal extends Animal { + + // only public for testing (normally private) + public static ElementReference flightInstructorChild; + public static ElementReferenceCollection flightPartnerRefsColl; + public static Attribute wingspanAttribute; + + public static void registerType(ModelBuilder modelBuilder) { + + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(FlyingAnimal.class, TYPE_NAME_FLYING_ANIMAL) + .namespaceUri(MODEL_NAMESPACE) + .extendsType(Animal.class) + .abstractType(); + + wingspanAttribute = typeBuilder.doubleAttribute(ATTRIBUTE_NAME_WINGSPAN) + .build(); + + SequenceBuilder sequence = typeBuilder.sequence(); + + flightInstructorChild = sequence.element(FlightInstructor.class) + .idElementReference(FlyingAnimal.class) + .build(); + + flightPartnerRefsColl = sequence.elementCollection(FlightPartnerRef.class) + .idElementReferenceCollection(FlyingAnimal.class) + .build(); + + typeBuilder.build(); + + } + + FlyingAnimal(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public Double getWingspan() { + return wingspanAttribute.getValue(this); + } + + public void setWingspan(double wingspan) { + wingspanAttribute.setValue(this, wingspan); + } + + public FlyingAnimal getFlightInstructor() { + return flightInstructorChild.getReferenceTargetElement(this); + } + + public void setFlightInstructor(FlyingAnimal flightInstructor) { + flightInstructorChild.setReferenceTargetElement(this, flightInstructor); + } + + public void removeFlightInstructor() { + flightInstructorChild.clearReferenceTargetElement(this); + } + + public Collection getFlightPartnerRefs() { + return flightPartnerRefsColl.getReferenceTargetElements(this); + } + + public Collection getFlightPartnerRefElements() { + return flightPartnerRefsColl.getReferenceSourceCollection().get(this); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FlyingAnimalTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FlyingAnimalTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b6af06427c7f63bcb600947fb84111f146469ee7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FlyingAnimalTest.java @@ -0,0 +1,289 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.parser.AbstractModelParser; +import org.camunda.bpm.model.xml.testmodel.Gender; +import org.camunda.bpm.model.xml.testmodel.TestModelParser; +import org.camunda.bpm.model.xml.testmodel.TestModelTest; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; +import static org.junit.runners.Parameterized.Parameters; + +/** + * @author Sebastian Menski + */ +public class FlyingAnimalTest extends TestModelTest { + + private FlyingAnimal tweety; + private FlyingAnimal hedwig; + private FlyingAnimal birdo; + private FlyingAnimal plucky; + private FlyingAnimal fiffy; + private FlyingAnimal timmy; + private FlyingAnimal daisy; + + public FlyingAnimalTest(String testName, ModelInstance testModelInstance, AbstractModelParser modelParser) { + super(testName, testModelInstance, modelParser); + } + + @Parameters(name="Model {0}") + public static Collection models() { + Object[][] models = {createModel(), parseModel(FlyingAnimalTest.class)}; + return Arrays.asList(models); + } + + public static Object[] createModel() { + TestModelParser modelParser = new TestModelParser(); + ModelInstance modelInstance = modelParser.getEmptyModel(); + + Animals animals = modelInstance.newInstance(Animals.class); + modelInstance.setDocumentElement(animals); + + // add a tns namespace prefix for QName testing + animals.getDomElement().registerNamespace("tns", MODEL_NAMESPACE); + + FlyingAnimal tweety = createBird(modelInstance, "tweety", Gender.Female); + FlyingAnimal hedwig = createBird(modelInstance, "hedwig", Gender.Male); + FlyingAnimal birdo = createBird(modelInstance, "birdo", Gender.Female); + FlyingAnimal plucky = createBird(modelInstance, "plucky", Gender.Unknown); + FlyingAnimal fiffy = createBird(modelInstance, "fiffy", Gender.Female); + createBird(modelInstance, "timmy", Gender.Male); + createBird(modelInstance, "daisy", Gender.Female); + + tweety.setFlightInstructor(hedwig); + + tweety.getFlightPartnerRefs().add(hedwig); + tweety.getFlightPartnerRefs().add(birdo); + tweety.getFlightPartnerRefs().add(plucky); + tweety.getFlightPartnerRefs().add(fiffy); + + + return new Object[]{"created", modelInstance, modelParser}; + } + + @Before + public void copyModelInstance() { + modelInstance = cloneModelInstance(); + tweety = modelInstance.getModelElementById("tweety"); + hedwig = modelInstance.getModelElementById("hedwig"); + birdo = modelInstance.getModelElementById("birdo"); + plucky = modelInstance.getModelElementById("plucky"); + fiffy = modelInstance.getModelElementById("fiffy"); + timmy = modelInstance.getModelElementById("timmy"); + daisy = modelInstance.getModelElementById("daisy"); + } + + @Test + public void testSetWingspanAttributeByHelper() { + double wingspan = 2.123; + tweety.setWingspan(wingspan); + assertThat(tweety.getWingspan()).isEqualTo(wingspan); + } + + @Test + public void testSetWingspanAttributeByAttributeName() { + Double wingspan = 2.123; + tweety.setAttributeValue("wingspan", wingspan.toString(), false); + assertThat(tweety.getWingspan()).isEqualTo(wingspan); + } + + @Test + public void testRemoveWingspanAttribute() { + double wingspan = 2.123; + tweety.setWingspan(wingspan); + assertThat(tweety.getWingspan()).isEqualTo(wingspan); + + tweety.removeAttribute("wingspan"); + + assertThat(tweety.getWingspan()).isNull(); + } + + @Test + public void testSetFlightInstructorByHelper() { + tweety.setFlightInstructor(timmy); + assertThat(tweety.getFlightInstructor()).isEqualTo(timmy); + } + + @Test + public void testUpdateFlightInstructorByIdHelper() { + hedwig.setId("new-" + hedwig.getId()); + assertThat(tweety.getFlightInstructor()).isEqualTo(hedwig); + } + + @Test + public void testUpdateFlightInstructorByIdAttributeName() { + hedwig.setAttributeValue("id", "new-" + hedwig.getId(), true); + assertThat(tweety.getFlightInstructor()).isEqualTo(hedwig); + } + + @Test + public void testUpdateFlightInstructorByReplaceElement() { + hedwig.replaceWithElement(timmy); + assertThat(tweety.getFlightInstructor()).isEqualTo(timmy); + } + + @Test + public void testUpdateFlightInstructorByRemoveElement() { + Animals animals = (Animals) modelInstance.getDocumentElement(); + animals.getAnimals().remove(hedwig); + assertThat(tweety.getFlightInstructor()).isNull(); + } + + @Test + public void testClearFlightInstructor() { + tweety.removeFlightInstructor(); + assertThat(tweety.getFlightInstructor()).isNull(); + } + + @Test + public void testAddFlightPartnerRefsByHelper() { + assertThat(tweety.getFlightPartnerRefs()) + .isNotEmpty() + .hasSize(4) + .containsOnly(hedwig, birdo, plucky, fiffy); + + tweety.getFlightPartnerRefs().add(timmy); + tweety.getFlightPartnerRefs().add(daisy); + + assertThat(tweety.getFlightPartnerRefs()) + .isNotEmpty() + .hasSize(6) + .containsOnly(hedwig, birdo, plucky, fiffy, timmy, daisy); + } + + @Test + public void testUpdateFlightPartnerRefsByIdByHelper() { + hedwig.setId("new-" + hedwig.getId()); + plucky.setId("new-" + plucky.getId()); + assertThat(tweety.getFlightPartnerRefs()) + .hasSize(4) + .containsOnly(hedwig, birdo, plucky, fiffy); + } + + @Test + public void testUpdateFlightPartnerRefsByIdByAttributeName() { + birdo.setAttributeValue("id", "new-" + birdo.getId(), true); + fiffy.setAttributeValue("id", "new-" + fiffy.getId(), true); + assertThat(tweety.getFlightPartnerRefs()) + .hasSize(4) + .containsOnly(hedwig, birdo, plucky, fiffy); + } + + @Test + public void testUpdateFlightPartnerRefsByReplaceElements() { + hedwig.replaceWithElement(timmy); + plucky.replaceWithElement(daisy); + assertThat(tweety.getFlightPartnerRefs()) + .hasSize(4) + .containsOnly(birdo, fiffy, timmy ,daisy); + } + + @Test + public void testUpdateFlightPartnerRefsByRemoveElements() { + tweety.getFlightPartnerRefs().remove(birdo); + tweety.getFlightPartnerRefs().remove(fiffy); + assertThat(tweety.getFlightPartnerRefs()) + .hasSize(2) + .containsOnly(hedwig, plucky); + } + + @Test + public void testClearFlightPartnerRefs() { + tweety.getFlightPartnerRefs().clear(); + assertThat(tweety.getFlightPartnerRefs()).isEmpty(); + } + + @Test + public void testAddFlightPartnerRefElementsByHelper() { + assertThat(tweety.getFlightPartnerRefElements()) + .isNotEmpty() + .hasSize(4); + + FlightPartnerRef timmyFlightPartnerRef = modelInstance.newInstance(FlightPartnerRef.class); + timmyFlightPartnerRef.setTextContent(timmy.getId()); + tweety.getFlightPartnerRefElements().add(timmyFlightPartnerRef); + + FlightPartnerRef daisyFlightPartnerRef = modelInstance.newInstance(FlightPartnerRef.class); + daisyFlightPartnerRef.setTextContent(daisy.getId()); + tweety.getFlightPartnerRefElements().add(daisyFlightPartnerRef); + + assertThat(tweety.getFlightPartnerRefElements()) + .isNotEmpty() + .hasSize(6) + .contains(timmyFlightPartnerRef, daisyFlightPartnerRef); + } + + @Test + public void testFlightPartnerRefElementsByTextContent() { + Collection flightPartnerRefElements = tweety.getFlightPartnerRefElements(); + Collection textContents = new ArrayList(); + for (FlightPartnerRef flightPartnerRefElement : flightPartnerRefElements) { + String textContent = flightPartnerRefElement.getTextContent(); + assertThat(textContent).isNotEmpty(); + textContents.add(textContent); + } + assertThat(textContents) + .isNotEmpty() + .hasSize(4) + .containsOnly(hedwig.getId(), birdo.getId(), plucky.getId(), fiffy.getId()); + } + + @Test + public void testUpdateFlightPartnerRefElementsByTextContent() { + List flightPartnerRefs = new ArrayList(tweety.getFlightPartnerRefElements()); + + flightPartnerRefs.get(0).setTextContent(timmy.getId()); + flightPartnerRefs.get(2).setTextContent(daisy.getId()); + + assertThat(tweety.getFlightPartnerRefs()) + .hasSize(4) + .containsOnly(birdo, fiffy, timmy, daisy); + } + + @Test + public void testUpdateFlightPartnerRefElementsByRemoveElements() { + List flightPartnerRefs = new ArrayList(tweety.getFlightPartnerRefElements()); + tweety.getFlightPartnerRefElements().remove(flightPartnerRefs.get(1)); + tweety.getFlightPartnerRefElements().remove(flightPartnerRefs.get(3)); + assertThat(tweety.getFlightPartnerRefs()) + .hasSize(2) + .containsOnly(hedwig, plucky); + } + + @Test + public void testClearFlightPartnerRefElements() { + tweety.getFlightPartnerRefElements().clear(); + assertThat(tweety.getFlightPartnerRefElements()).isEmpty(); + + // should not affect animals collection + Animals animals = (Animals) modelInstance.getDocumentElement(); + assertThat(animals.getAnimals()) + .isNotEmpty() + .hasSize(7); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FriendRelationshipDefinition.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FriendRelationshipDefinition.java new file mode 100644 index 0000000000000000000000000000000000000000..815ff4b6a6fbf896da4cd62d7474b75346befcda --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/FriendRelationshipDefinition.java @@ -0,0 +1,50 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.TYPE_NAME_FRIEND_RELATIONSHIP_DEFINITION; + +/** + * @author Sebastian Menski + */ +public class FriendRelationshipDefinition extends RelationshipDefinition { + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(FriendRelationshipDefinition.class, TYPE_NAME_FRIEND_RELATIONSHIP_DEFINITION) + .namespaceUri(MODEL_NAMESPACE) + .extendsType(RelationshipDefinition.class) + .instanceProvider(new ModelTypeInstanceProvider() { + + public FriendRelationshipDefinition newInstance(ModelTypeInstanceContext instanceContext) { + return new FriendRelationshipDefinition(instanceContext); + } + }); + + typeBuilder.build(); + } + + public FriendRelationshipDefinition(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/GuardEgg.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/GuardEgg.java new file mode 100644 index 0000000000000000000000000000000000000000..5cee790b14252ef6c5740cd38e852091cc3a635a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/GuardEgg.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ELEMENT_NAME_GUARD_EGG; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class GuardEgg extends ModelElementInstanceImpl { + + public GuardEgg(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(GuardEgg.class, ELEMENT_NAME_GUARD_EGG) + .namespaceUri(MODEL_NAMESPACE) + .instanceProvider(new ModelTypeInstanceProvider() { + public GuardEgg newInstance(ModelTypeInstanceContext instanceContext) { + return new GuardEgg(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Guardian.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Guardian.java new file mode 100644 index 0000000000000000000000000000000000000000..ab7aa203b2354e6c528ce529946fc817b588675d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Guardian.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.*; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.testmodel.TestModelConstants; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class Guardian extends AnimalReference { + + public Guardian(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Guardian.class, ELEMENT_NAME_GUARDIAN) + .namespaceUri(MODEL_NAMESPACE) + .extendsType(AnimalReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Guardian newInstance(ModelTypeInstanceContext instanceContext) { + return new Guardian(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Mother.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Mother.java new file mode 100644 index 0000000000000000000000000000000000000000..4cf703cbbea2ad5f32261ffc7c49f7ba8cafa892 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Mother.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.*; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.testmodel.TestModelConstants; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +public class Mother extends AnimalReference { + + public Mother(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Mother.class, ELEMENT_NAME_MOTHER) + .namespaceUri(MODEL_NAMESPACE) + .extendsType(AnimalReference.class) + .instanceProvider(new ModelTypeInstanceProvider() { + public Mother newInstance(ModelTypeInstanceContext instanceContext) { + return new Mother(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/RelationshipDefinition.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/RelationshipDefinition.java new file mode 100644 index 0000000000000000000000000000000000000000..c2b2ff0dd17d90e3ca01a4567531ef4995d45e93 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/RelationshipDefinition.java @@ -0,0 +1,71 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.camunda.bpm.model.xml.type.reference.AttributeReference; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.*; + +/** + * @author Sebastian Menski + */ +public abstract class RelationshipDefinition extends ModelElementInstanceImpl { + + protected static Attribute idAttr; + protected static AttributeReference animalRef; + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(RelationshipDefinition.class, TYPE_NAME_RELATIONSHIP_DEFINITION) + .namespaceUri(MODEL_NAMESPACE) + .abstractType(); + + idAttr = typeBuilder.stringAttribute(ATTRIBUTE_NAME_ID) + .idAttribute() + .build(); + + animalRef = typeBuilder.stringAttribute(ATTRIBUTE_NAME_ANIMAL_REF) + .idAttributeReference(Animal.class) + .build(); + + typeBuilder.build(); + } + + public RelationshipDefinition(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public String getId() { + return idAttr.getValue(this); + } + + public void setId(String id) { + idAttr.setValue(this, id); + } + + public void setAnimal(Animal animalInRelationshipWith) { + animalRef.setReferenceTargetElement(this, animalInRelationshipWith); + } + + public Animal getAnimal() { + return animalRef.getReferenceTargetElement(this); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/RelationshipDefinitionRef.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/RelationshipDefinitionRef.java new file mode 100644 index 0000000000000000000000000000000000000000..86dfa4d4ec2da08e54c213a94a13942a9ab31b2e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/RelationshipDefinitionRef.java @@ -0,0 +1,50 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ELEMENT_NAME_RELATIONSHIP_DEFINITION_REF; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; + +/** + * @author Sebastian Menski + */ +public class RelationshipDefinitionRef extends ModelElementInstanceImpl { + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(RelationshipDefinitionRef.class, ELEMENT_NAME_RELATIONSHIP_DEFINITION_REF) + .namespaceUri(MODEL_NAMESPACE) + .instanceProvider(new ModelTypeInstanceProvider() { + + public RelationshipDefinitionRef newInstance(ModelTypeInstanceContext instanceContext) { + return new RelationshipDefinitionRef(instanceContext); + } + }); + + typeBuilder.build(); + } + + public RelationshipDefinitionRef(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/SpouseRef.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/SpouseRef.java new file mode 100644 index 0000000000000000000000000000000000000000..5396cb5cff3290a2f7253a7017cecc8917dd6219 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/SpouseRef.java @@ -0,0 +1,47 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.ELEMENT_NAME_SPOUSE_REF; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; + +/** + * @author Sebastian Menski + */ +public class SpouseRef extends ModelElementInstanceImpl { + + public static void registerType(ModelBuilder modelBuilder) { + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(SpouseRef.class, ELEMENT_NAME_SPOUSE_REF) + .namespaceUri(MODEL_NAMESPACE) + .instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider() { + public SpouseRef newInstance(ModelTypeInstanceContext instanceContext) { + return new SpouseRef(instanceContext); + } + }); + + typeBuilder.build(); + } + + public SpouseRef(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/UnknownAnimalTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/UnknownAnimalTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f6dad2b69a45a572cfd8311ab90605b8d22fe48a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/UnknownAnimalTest.java @@ -0,0 +1,179 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import org.camunda.bpm.model.xml.ModelException; +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.ModelInstanceImpl; +import org.camunda.bpm.model.xml.impl.parser.AbstractModelParser; +import org.camunda.bpm.model.xml.instance.DomDocument; +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.testmodel.TestModelParser; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; +import static org.junit.Assert.fail; + +/** + * @author Sebastian Menski + */ +public class UnknownAnimalTest { + + private AbstractModelParser modelParser; + private ModelInstance modelInstance; + private ModelElementInstance wanda; + private ModelElementInstance flipper; + + @Before + public void parseModel() { + modelParser = new TestModelParser(); + String testXml = this.getClass().getSimpleName() + ".xml"; + InputStream testXmlAsStream = this.getClass().getResourceAsStream(testXml); + modelInstance = modelParser.parseModelFromStream(testXmlAsStream); + wanda = modelInstance.getModelElementById("wanda"); + flipper = modelInstance.getModelElementById("flipper"); + } + + @After + public void validateModel() { + DomDocument document = modelInstance.getDocument(); + modelParser.validateModel(document); + } + + @Test + public void testGetUnknownAnimalById() { + assertThat(wanda).isNotNull(); + assertThat(wanda.getAttributeValue("id")).isEqualTo("wanda"); + assertThat(wanda.getAttributeValue("gender")).isEqualTo("Female"); + assertThat(wanda.getAttributeValue("species")).isEqualTo("fish"); + + assertThat(flipper).isNotNull(); + assertThat(flipper.getAttributeValue("id")).isEqualTo("flipper"); + assertThat(flipper.getAttributeValue("gender")).isEqualTo("Male"); + assertThat(flipper.getAttributeValue("species")).isEqualTo("dolphin"); + } + + @Test + public void testGetUnknownAnimalByType() { + ModelInstanceImpl modelInstanceImpl = (ModelInstanceImpl) modelInstance; + ModelElementType unknownAnimalType = modelInstanceImpl.registerGenericType(MODEL_NAMESPACE, "unknownAnimal"); + List unknownAnimals = new ArrayList(modelInstance.getModelElementsByType(unknownAnimalType)); + assertThat(unknownAnimals).hasSize(2); + + ModelElementInstance wanda = unknownAnimals.get(0); + assertThat(wanda.getAttributeValue("id")).isEqualTo("wanda"); + assertThat(wanda.getAttributeValue("gender")).isEqualTo("Female"); + assertThat(wanda.getAttributeValue("species")).isEqualTo("fish"); + + ModelElementInstance flipper = unknownAnimals.get(1); + assertThat(flipper.getAttributeValue("id")).isEqualTo("flipper"); + assertThat(flipper.getAttributeValue("gender")).isEqualTo("Male"); + assertThat(flipper.getAttributeValue("species")).isEqualTo("dolphin"); + } + + @Test + public void testAddUnknownAnimal() { + ModelInstanceImpl modelInstanceImpl = (ModelInstanceImpl) modelInstance; + ModelElementType unknownAnimalType = modelInstanceImpl.registerGenericType(MODEL_NAMESPACE, "unknownAnimal"); + ModelElementType animalsType = modelInstance.getModel().getType(Animals.class); + ModelElementType animalType = modelInstance.getModel().getType(Animal.class); + + ModelElementInstance unknownAnimal = modelInstance.newInstance(unknownAnimalType); + assertThat(unknownAnimal).isNotNull(); + unknownAnimal.setAttributeValue("id", "new-animal", true); + unknownAnimal.setAttributeValue("gender", "Unknown"); + unknownAnimal.setAttributeValue("species", "unknown"); + + ModelElementInstance animals = modelInstance.getModelElementsByType(animalsType).iterator().next(); + List childElementsByType = new ArrayList(animals.getChildElementsByType(animalType)); + animals.insertElementAfter(unknownAnimal, childElementsByType.get(2)); + assertThat(animals.getChildElementsByType(unknownAnimalType)).hasSize(3); + } + + @Test + public void testGetUnknownAttribute() { + assertThat(flipper.getAttributeValue("famous")).isEqualTo("true"); + + assertThat(wanda.getAttributeValue("famous")).isNotEqualTo("true"); + wanda.setAttributeValue("famous", "true"); + assertThat(wanda.getAttributeValue("famous")).isEqualTo("true"); + } + + @Test + public void testAddRelationshipDefinitionToUnknownAnimal() { + RelationshipDefinition friendRelationshipDefinition = modelInstance.newInstance(FriendRelationshipDefinition.class); + friendRelationshipDefinition.setId("friend-relationship"); + friendRelationshipDefinition.setAttributeValue("animalRef", flipper.getAttributeValue("id")); + + try { + wanda.addChildElement(friendRelationshipDefinition); + fail("Cannot add relationship definition to UnknownAnimal cause no child types are defined"); + } + catch (Exception e) { + assertThat(e).isInstanceOf(ModelException.class); + } + + wanda.insertElementAfter(friendRelationshipDefinition, null); + + Animal tweety = modelInstance.getModelElementById("tweety"); + RelationshipDefinition childRelationshipDefinition = modelInstance.newInstance(ChildRelationshipDefinition.class); + childRelationshipDefinition.setId("child-relationship"); + childRelationshipDefinition.setAnimal(tweety); + + wanda.insertElementAfter(childRelationshipDefinition, friendRelationshipDefinition); + } + + @Test + public void testAddChildToUnknownAnimal() { + assertThat(wanda.getChildElementsByType(flipper.getElementType())).hasSize(0); + wanda.insertElementAfter(flipper, null); + assertThat(wanda.getChildElementsByType(flipper.getElementType())).hasSize(1); + } + + @Test + public void testRemoveChildOfUnknownAnimal() { + assertThat(wanda.removeChildElement(flipper)).isFalse(); + wanda.insertElementAfter(flipper, null); + assertThat(wanda.removeChildElement(flipper)).isTrue(); + assertThat(wanda.getChildElementsByType(flipper.getElementType())).isEmpty(); + } + + @Test + public void testReplaceChildOfUnknownAnimal() { + ModelElementInstance yogi = modelInstance.newInstance(flipper.getElementType()); + yogi.setAttributeValue("id", "yogi-bear", true); + yogi.setAttributeValue("gender", "Male"); + yogi.setAttributeValue("species", "bear"); + + assertThat(wanda.getChildElementsByType(flipper.getElementType())).isEmpty(); + wanda.insertElementAfter(flipper, null); + assertThat(wanda.getChildElementsByType(flipper.getElementType())).hasSize(1); + wanda.replaceChildElement(flipper, yogi); + assertThat(wanda.getChildElementsByType(flipper.getElementType())).hasSize(1); + assertThat(wanda.getChildElementsByType(flipper.getElementType()).iterator().next()) + .isEqualTo(yogi); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Wings.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Wings.java new file mode 100644 index 0000000000000000000000000000000000000000..5b7e8953b449151242016f8c4464e74232444f75 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/testmodel/instance/Wings.java @@ -0,0 +1,55 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.testmodel.instance; + +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.NEWER_NAMESPACE; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.TYPE_NAME_WINGS; + +import org.camunda.bpm.model.xml.ModelBuilder; +import org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl; +import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; +import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; + +/** + * @author Ronny Bräunlich + * + */ +public class Wings extends ModelElementInstanceImpl{ + + /** + * @param instanceContext + */ + public Wings(ModelTypeInstanceContext instanceContext) { + super(instanceContext); + } + + public static void registerType(ModelBuilder modelBuilder) { + + ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Wings.class, TYPE_NAME_WINGS) + .namespaceUri(NEWER_NAMESPACE) + .instanceProvider(new ModelTypeInstanceProvider() { + @Override + public Wings newInstance(ModelTypeInstanceContext instanceContext) { + return new Wings(instanceContext); + } + }); + + typeBuilder.build(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/type/ModelElementTypeTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/type/ModelElementTypeTest.java new file mode 100644 index 0000000000000000000000000000000000000000..795d64df6859256376008298dd619a2526a97db6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/type/ModelElementTypeTest.java @@ -0,0 +1,170 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type; + +import org.camunda.bpm.model.xml.Model; +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.util.ModelTypeException; +import org.camunda.bpm.model.xml.testmodel.TestModelParser; +import org.camunda.bpm.model.xml.testmodel.instance.*; +import org.junit.Before; +import org.junit.Test; + +import static org.camunda.bpm.model.xml.test.assertions.ModelAssertions.assertThat; +import static org.camunda.bpm.model.xml.testmodel.TestModelConstants.MODEL_NAMESPACE; +import static org.junit.Assert.fail; + +/** + * @author Sebastian Menski + */ +public class ModelElementTypeTest { + + private ModelInstance modelInstance; + private Model model; + private ModelElementType animalsType; + private ModelElementType animalType; + private ModelElementType flyingAnimalType; + private ModelElementType birdType; + + @Before + public void getTypes() { + TestModelParser modelParser = new TestModelParser(); + modelInstance = modelParser.getEmptyModel(); + model = modelInstance.getModel(); + animalsType = model.getType(Animals.class); + animalType = model.getType(Animal.class); + flyingAnimalType = model.getType(FlyingAnimal.class); + birdType = model.getType(Bird.class); + } + + @Test + public void testTypeName() { + assertThat(animalsType).hasTypeName("animals"); + assertThat(animalType).hasTypeName("animal"); + assertThat(flyingAnimalType).hasTypeName("flyingAnimal"); + assertThat(birdType).hasTypeName("bird"); + } + + @Test + public void testTypeNamespace() { + assertThat(animalsType).hasTypeNamespace(MODEL_NAMESPACE); + assertThat(animalType).hasTypeNamespace(MODEL_NAMESPACE); + assertThat(flyingAnimalType).hasTypeNamespace(MODEL_NAMESPACE); + assertThat(birdType).hasTypeNamespace(MODEL_NAMESPACE); + } + + @Test + public void testInstanceType() { + assertThat(animalsType).hasInstanceType(Animals.class); + assertThat(animalType).hasInstanceType(Animal.class); + assertThat(flyingAnimalType).hasInstanceType(FlyingAnimal.class); + assertThat(birdType).hasInstanceType(Bird.class); + } + + @Test + public void testAttributes() { + assertThat(animalsType).hasNoAttributes(); + assertThat(animalType).hasAttributes("id", "name", "father", "mother", "isEndangered", "gender", "age"); + assertThat(flyingAnimalType).hasAttributes("wingspan"); + assertThat(birdType).hasAttributes("canHazExtendedWings"); + } + + @Test + public void testBaseType() { + assertThat(animalsType).extendsNoType(); + assertThat(animalType).extendsNoType(); + assertThat(flyingAnimalType).extendsType(animalType); + assertThat(birdType).extendsType(flyingAnimalType); + } + + @Test + public void testAbstractType() { + assertThat(animalsType).isNotAbstract(); + assertThat(animalType).isAbstract(); + assertThat(flyingAnimalType).isAbstract(); + assertThat(birdType).isNotAbstract(); + } + + @Test + public void testExtendingTypes() { + assertThat(animalsType).isNotExtended(); + assertThat(animalType) + .isExtendedBy(flyingAnimalType) + .isNotExtendedBy(birdType); + assertThat(flyingAnimalType).isExtendedBy(birdType); + assertThat(birdType).isNotExtended(); + } + + @Test + public void testModel() { + assertThat(animalsType).isPartOfModel(model); + assertThat(animalType).isPartOfModel(model); + assertThat(flyingAnimalType).isPartOfModel(model); + assertThat(birdType).isPartOfModel(model); + } + + @Test + public void testInstances() { + assertThat(animalsType.getInstances(modelInstance)).isEmpty(); + assertThat(animalType.getInstances(modelInstance)).isEmpty(); + assertThat(flyingAnimalType.getInstances(modelInstance)).isEmpty(); + assertThat(birdType.getInstances(modelInstance)).isEmpty(); + + Animals animals = (Animals) animalsType.newInstance(modelInstance); + modelInstance.setDocumentElement(animals); + + try { + animalType.newInstance(modelInstance); + fail("Animal is a abstract type and not instance can be created."); + } + catch (Exception e) { + assertThat(e).isInstanceOf(ModelTypeException.class); + } + + try { + flyingAnimalType.newInstance(modelInstance); + fail("Flying animal is a abstract type and not instance can be created."); + } + catch (Exception e) { + assertThat(e).isInstanceOf(ModelTypeException.class); + } + + animals.getAnimals().add((Animal) birdType.newInstance(modelInstance)); + animals.getAnimals().add((Animal) birdType.newInstance(modelInstance)); + animals.getAnimals().add((Animal) birdType.newInstance(modelInstance)); + + assertThat(animalsType.getInstances(modelInstance)).hasSize(1); + assertThat(animalType.getInstances(modelInstance)).isEmpty(); + assertThat(flyingAnimalType.getInstances(modelInstance)).isEmpty(); + assertThat(birdType.getInstances(modelInstance)).hasSize(3); + } + + @Test + public void testChildElementTypes() { + ModelElementType relationshipDefinitionType = model.getType(RelationshipDefinition.class); + ModelElementType relationshipDefinitionRefType = model.getType(RelationshipDefinitionRef.class); + ModelElementType flightPartnerRefType = model.getType(FlightPartnerRef.class); + ModelElementType eggType = model.getType(Egg.class); + ModelElementType spouseRefType = model.getType(SpouseRef.class); + + assertThat(animalsType).hasChildElements(animalType); + assertThat(animalType).hasChildElements(relationshipDefinitionType, relationshipDefinitionRefType); + assertThat(flyingAnimalType).hasChildElements(flightPartnerRefType); + assertThat(birdType).hasChildElements(eggType, spouseRefType); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/type/attribute/AttributeTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/type/attribute/AttributeTest.java new file mode 100644 index 0000000000000000000000000000000000000000..487ffe099f3ba6e1ae86b1e74e0fd01151607690 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/type/attribute/AttributeTest.java @@ -0,0 +1,187 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.attribute; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.parser.AbstractModelParser; +import org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl; +import org.camunda.bpm.model.xml.testmodel.Gender; +import org.camunda.bpm.model.xml.testmodel.TestModelParser; +import org.camunda.bpm.model.xml.testmodel.TestModelTest; +import org.camunda.bpm.model.xml.testmodel.instance.Animal; +import org.camunda.bpm.model.xml.testmodel.instance.AnimalTest; +import org.camunda.bpm.model.xml.testmodel.instance.Animals; +import org.camunda.bpm.model.xml.testmodel.instance.Bird; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.junit.Before; +import org.junit.Test; + +import java.util.Arrays; +import java.util.Collection; + +import static org.camunda.bpm.model.xml.test.assertions.ModelAssertions.assertThat; +import static org.junit.runners.Parameterized.Parameters; + +/** + * @author Sebastian Menski + */ +public class AttributeTest extends TestModelTest { + + private Bird tweety; + private Attribute idAttribute; + private Attribute nameAttribute; + private Attribute fatherAttribute; + + public AttributeTest(String testName, ModelInstance testModelInstance, AbstractModelParser modelParser) { + super(testName, testModelInstance, modelParser); + } + + @Parameters(name="Model {0}") + public static Collection models() { + Object[][] models = {createModel(), parseModel(AnimalTest.class)}; + return Arrays.asList(models); + } + + public static Object[] createModel() { + TestModelParser modelParser = new TestModelParser(); + ModelInstance modelInstance = modelParser.getEmptyModel(); + + Animals animals = modelInstance.newInstance(Animals.class); + modelInstance.setDocumentElement(animals); + + createBird(modelInstance, "tweety", Gender.Female); + + return new Object[]{"created", modelInstance, modelParser}; + } + + @Before + @SuppressWarnings("unchecked") + public void copyModelInstance() { + modelInstance = cloneModelInstance(); + + tweety = modelInstance.getModelElementById("tweety"); + + ModelElementType animalType = modelInstance.getModel().getType(Animal.class); + idAttribute = (Attribute) animalType.getAttribute("id"); + nameAttribute = (Attribute) animalType.getAttribute("name"); + fatherAttribute = (Attribute) animalType.getAttribute("father"); + } + + @Test + public void testOwningElementType() { + ModelElementType animalType = modelInstance.getModel().getType(Animal.class); + + assertThat(idAttribute).hasOwningElementType(animalType); + assertThat(nameAttribute).hasOwningElementType(animalType); + assertThat(fatherAttribute).hasOwningElementType(animalType); + } + + @Test + public void testSetAttributeValue() { + String identifier = "new-" + tweety.getId(); + idAttribute.setValue(tweety, identifier); + assertThat(idAttribute).hasValue(tweety, identifier); + } + + @Test + public void testSetAttributeValueWithoutUpdateReference() { + String identifier = "new-" + tweety.getId(); + idAttribute.setValue(tweety, identifier, false); + assertThat(idAttribute).hasValue(tweety, identifier); + } + + @Test + public void testSetDefaultValue() { + String defaultName = "default-name"; + assertThat(tweety.getName()).isNull(); + assertThat(nameAttribute).hasNoDefaultValue(); + + ((AttributeImpl) nameAttribute).setDefaultValue(defaultName); + assertThat(nameAttribute).hasDefaultValue(defaultName); + assertThat(tweety.getName()).isEqualTo(defaultName); + + tweety.setName("not-" + defaultName); + assertThat(tweety.getName()).isNotEqualTo(defaultName); + + tweety.removeAttribute("name"); + assertThat(tweety.getName()).isEqualTo(defaultName); + ((AttributeImpl) nameAttribute).setDefaultValue(null); + assertThat(nameAttribute).hasNoDefaultValue(); + } + + @Test + public void testRequired() { + tweety.removeAttribute("name"); + assertThat(nameAttribute).isOptional(); + + ((AttributeImpl) nameAttribute).setRequired(true); + assertThat(nameAttribute).isRequired(); + + ((AttributeImpl) nameAttribute).setRequired(false); + } + + @Test + public void testSetNamespaceUri() { + String testNamespace = "http://camunda.org/test"; + + ((AttributeImpl) idAttribute).setNamespaceUri(testNamespace); + assertThat(idAttribute).hasNamespaceUri(testNamespace); + + ((AttributeImpl) idAttribute).setNamespaceUri(null); + assertThat(idAttribute).hasNoNamespaceUri(); + } + + @Test + public void testIdAttribute() { + assertThat(idAttribute).isIdAttribute(); + assertThat(nameAttribute).isNotIdAttribute(); + assertThat(fatherAttribute).isNotIdAttribute(); + } + + @Test + public void testAttributeName() { + assertThat(idAttribute).hasAttributeName("id"); + assertThat(nameAttribute).hasAttributeName("name"); + assertThat(fatherAttribute).hasAttributeName("father"); + } + + @Test + public void testRemoveAttribute() { + tweety.setName("test"); + assertThat(tweety.getName()).isNotNull(); + assertThat(nameAttribute).hasValue(tweety); + + ((AttributeImpl) nameAttribute).removeAttribute(tweety); + assertThat(tweety.getName()).isNull(); + assertThat(nameAttribute).hasNoValue(tweety); + } + + @Test + public void testIncomingReferences() { + assertThat(idAttribute).hasIncomingReferences(); + assertThat(nameAttribute).hasNoIncomingReferences(); + assertThat(fatherAttribute).hasNoIncomingReferences(); + } + + @Test + public void testOutgoingReferences() { + assertThat(idAttribute).hasNoOutgoingReferences(); + assertThat(nameAttribute).hasNoOutgoingReferences(); + assertThat(fatherAttribute).hasOutgoingReferences(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/type/child/ChildElementCollectionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/type/child/ChildElementCollectionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..83659135b92bc526454587993c380c1130fe12de --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/type/child/ChildElementCollectionTest.java @@ -0,0 +1,218 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.child; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.UnsupportedModelOperationException; +import org.camunda.bpm.model.xml.impl.parser.AbstractModelParser; +import org.camunda.bpm.model.xml.impl.type.child.ChildElementCollectionImpl; +import org.camunda.bpm.model.xml.impl.type.child.ChildElementImpl; +import org.camunda.bpm.model.xml.testmodel.Gender; +import org.camunda.bpm.model.xml.testmodel.TestModelParser; +import org.camunda.bpm.model.xml.testmodel.TestModelTest; +import org.camunda.bpm.model.xml.testmodel.instance.*; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.junit.Before; +import org.junit.Test; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; + +import static org.camunda.bpm.model.xml.test.assertions.ModelAssertions.assertThat; +import static org.junit.Assert.fail; +import static org.junit.runners.Parameterized.Parameters; + +/** + * @author Sebastian Menski + */ +public class ChildElementCollectionTest extends TestModelTest { + + private Bird tweety; + private Bird daffy; + private Bird daisy; + private Bird plucky; + private Bird birdo; + private ChildElement flightInstructorChild; + private ChildElementCollection flightPartnerRefCollection; + + public ChildElementCollectionTest(String testName, ModelInstance testModelInstance, AbstractModelParser modelParser) { + super(testName, testModelInstance, modelParser); + } + + @Parameters(name="Model {0}") + public static Collection models() { + Object[][] models = {createModel(), parseModel(ChildElementCollectionTest.class)}; + return Arrays.asList(models); + } + + public static Object[] createModel() { + TestModelParser modelParser = new TestModelParser(); + ModelInstance modelInstance = modelParser.getEmptyModel(); + + Animals animals = modelInstance.newInstance(Animals.class); + modelInstance.setDocumentElement(animals); + + Bird tweety = createBird(modelInstance, "tweety", Gender.Female); + Bird daffy = createBird(modelInstance, "daffy", Gender.Male); + Bird daisy = createBird(modelInstance, "daisy", Gender.Female); + Bird plucky = createBird(modelInstance, "plucky", Gender.Male); + createBird(modelInstance, "birdo", Gender.Female); + + tweety.setFlightInstructor(daffy); + tweety.getFlightPartnerRefs().add(daisy); + tweety.getFlightPartnerRefs().add(plucky); + + return new Object[]{"created", modelInstance, modelParser}; + } + + @Before + public void copyModelInstance() { + modelInstance = cloneModelInstance(); + + tweety = modelInstance.getModelElementById("tweety"); + daffy = modelInstance.getModelElementById("daffy"); + daisy = modelInstance.getModelElementById("daisy"); + plucky = modelInstance.getModelElementById("plucky"); + birdo = modelInstance.getModelElementById("birdo"); + + flightInstructorChild = (ChildElement) FlyingAnimal.flightInstructorChild.getReferenceSourceCollection(); + flightPartnerRefCollection = FlyingAnimal.flightPartnerRefsColl.getReferenceSourceCollection(); + } + + @Test + public void testImmutable() { + assertThat(flightInstructorChild).isMutable(); + assertThat(flightPartnerRefCollection).isMutable(); + + ((ChildElementImpl) flightInstructorChild).setImmutable(); + ((ChildElementCollectionImpl) flightPartnerRefCollection).setImmutable(); + assertThat(flightInstructorChild).isImmutable(); + assertThat(flightPartnerRefCollection).isImmutable(); + + ((ChildElementImpl) flightInstructorChild).setMutable(true); + ((ChildElementCollectionImpl) flightPartnerRefCollection).setMutable(true); + assertThat(flightInstructorChild).isMutable(); + assertThat(flightPartnerRefCollection).isMutable(); + } + + @Test + public void testMinOccurs() { + assertThat(flightInstructorChild).isOptional(); + assertThat(flightPartnerRefCollection).isOptional(); + } + + @Test + public void testMaxOccurs() { + assertThat(flightInstructorChild).occursMaximal(1); + assertThat(flightPartnerRefCollection).isUnbounded(); + } + + @Test + public void testChildElementType() { + assertThat(flightInstructorChild).containsType(FlightInstructor.class); + assertThat(flightPartnerRefCollection).containsType(FlightPartnerRef.class); + } + + @Test + public void testParentElementType() { + ModelElementType flyingAnimalType = modelInstance.getModel().getType(FlyingAnimal.class); + + assertThat(flightInstructorChild).hasParentElementType(flyingAnimalType); + assertThat(flightPartnerRefCollection).hasParentElementType(flyingAnimalType); + } + + @Test + public void testGetChildElements() { + assertThat(flightInstructorChild).hasSize(tweety, 1); + assertThat(flightPartnerRefCollection).hasSize(tweety, 2); + + FlightInstructor flightInstructor = flightInstructorChild.getChild(tweety); + assertThat(flightInstructor.getTextContent()).isEqualTo(daffy.getId()); + + for (FlightPartnerRef flightPartnerRef : flightPartnerRefCollection.get(tweety)) { + assertThat(flightPartnerRef.getTextContent()).isIn(daisy.getId(), plucky.getId()); + } + } + + @Test + public void testRemoveChildElements() { + assertThat(flightInstructorChild).isNotEmpty(tweety); + assertThat(flightPartnerRefCollection).isNotEmpty(tweety); + + flightInstructorChild.removeChild(tweety); + flightPartnerRefCollection.get(tweety).clear(); + + assertThat(flightInstructorChild).isEmpty(tweety); + assertThat(flightPartnerRefCollection).isEmpty(tweety); + } + + @Test + public void testChildElementsCollection() { + Collection flightPartnerRefs = flightPartnerRefCollection.get(tweety); + + Iterator iterator = flightPartnerRefs.iterator(); + FlightPartnerRef daisyRef = iterator.next(); + FlightPartnerRef pluckyRef = iterator.next(); + assertThat(daisyRef.getTextContent()).isEqualTo(daisy.getId()); + assertThat(pluckyRef.getTextContent()).isEqualTo(plucky.getId()); + + FlightPartnerRef birdoRef = modelInstance.newInstance(FlightPartnerRef.class); + birdoRef.setTextContent(birdo.getId()); + + Collection flightPartners = Arrays.asList(birdoRef, daisyRef, pluckyRef); + + // directly test collection methods and not use the appropriate assertion methods + assertThat(flightPartnerRefs.size()).isEqualTo(2); + assertThat(flightPartnerRefs.isEmpty()).isFalse(); + assertThat(flightPartnerRefs.contains(daisyRef)); + assertThat(flightPartnerRefs.toArray()).isEqualTo(new Object[]{daisyRef, pluckyRef}); + assertThat(flightPartnerRefs.toArray(new FlightPartnerRef[1])).isEqualTo(new FlightPartnerRef[]{daisyRef, pluckyRef}); + + assertThat(flightPartnerRefs.add(birdoRef)).isTrue(); + assertThat(flightPartnerRefs) + .hasSize(3) + .containsOnly(birdoRef, daisyRef, pluckyRef); + + assertThat(flightPartnerRefs.remove(daisyRef)).isTrue(); + assertThat(flightPartnerRefs) + .hasSize(2) + .containsOnly(birdoRef, pluckyRef); + + assertThat(flightPartnerRefs.addAll(flightPartners)).isTrue(); + assertThat(flightPartnerRefs.containsAll(flightPartners)).isTrue(); + assertThat(flightPartnerRefs) + .hasSize(3) + .containsOnly(birdoRef, daisyRef, pluckyRef); + + assertThat(flightPartnerRefs.removeAll(flightPartners)).isTrue(); + assertThat(flightPartnerRefs).isEmpty(); + + try { + flightPartnerRefs.retainAll(flightPartners); + fail("retainAll method is not implemented"); + } + catch (Exception e) { + assertThat(e).isInstanceOf(UnsupportedModelOperationException.class); + } + + flightPartnerRefs.addAll(flightPartners); + assertThat(flightPartnerRefs).isNotEmpty(); + flightPartnerRefs.clear(); + assertThat(flightPartnerRefs).isEmpty(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/type/reference/ReferenceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/type/reference/ReferenceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6974f9e88a6550f139d3de376b88fe8b1472bab6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/type/reference/ReferenceTest.java @@ -0,0 +1,211 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.type.reference; + +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.UnsupportedModelOperationException; +import org.camunda.bpm.model.xml.impl.parser.AbstractModelParser; +import org.camunda.bpm.model.xml.impl.type.reference.AttributeReferenceImpl; +import org.camunda.bpm.model.xml.impl.type.reference.QNameAttributeReferenceImpl; +import org.camunda.bpm.model.xml.testmodel.Gender; +import org.camunda.bpm.model.xml.testmodel.TestModelParser; +import org.camunda.bpm.model.xml.testmodel.TestModelTest; +import org.camunda.bpm.model.xml.testmodel.instance.*; +import org.camunda.bpm.model.xml.type.ModelElementType; +import org.camunda.bpm.model.xml.type.attribute.Attribute; +import org.junit.Before; +import org.junit.Test; + +import java.util.Arrays; +import java.util.Collection; + +import static org.camunda.bpm.model.xml.test.assertions.ModelAssertions.assertThat; +import static org.junit.Assert.fail; +import static org.junit.runners.Parameterized.Parameters; + +/** + * @author Sebastian Menski + */ +public class ReferenceTest extends TestModelTest { + + private Bird tweety; + private Bird daffy; + private Bird daisy; + private Bird plucky; + private Bird birdo; + private FlightPartnerRef flightPartnerRef; + + private ModelElementType animalType; + private QNameAttributeReferenceImpl fatherReference; + private AttributeReferenceImpl motherReference; + private ElementReferenceCollection flightPartnerRefsColl; + + public ReferenceTest(String testName, ModelInstance testModelInstance, AbstractModelParser modelParser) { + super(testName, testModelInstance, modelParser); + } + + @Parameters(name="Model {0}") + public static Collection models() { + Object[][] models = {createModel(), parseModel(ReferenceTest.class)}; + return Arrays.asList(models); + } + + public static Object[] createModel() { + TestModelParser modelParser = new TestModelParser(); + ModelInstance modelInstance = modelParser.getEmptyModel(); + + Animals animals = modelInstance.newInstance(Animals.class); + modelInstance.setDocumentElement(animals); + + Bird tweety = createBird(modelInstance, "tweety", Gender.Female); + Bird daffy = createBird(modelInstance, "daffy", Gender.Male); + Bird daisy = createBird(modelInstance, "daisy", Gender.Female); + createBird(modelInstance, "plucky", Gender.Male); + createBird(modelInstance, "birdo", Gender.Female); + tweety.setFather(daffy); + tweety.setMother(daisy); + + tweety.getFlightPartnerRefs().add(daffy); + + return new Object[]{"created", modelInstance, modelParser}; + } + + @Before + @SuppressWarnings("unchecked") + public void copyModelInstance() { + modelInstance = cloneModelInstance(); + + tweety = modelInstance.getModelElementById("tweety"); + daffy = modelInstance.getModelElementById("daffy"); + daisy = modelInstance.getModelElementById("daisy"); + plucky = modelInstance.getModelElementById("plucky"); + birdo = modelInstance.getModelElementById("birdo"); + + animalType = modelInstance.getModel().getType(Animal.class); + + // QName attribute reference + fatherReference = (QNameAttributeReferenceImpl) animalType.getAttribute("father").getOutgoingReferences().iterator().next(); + + // ID attribute reference + motherReference = (AttributeReferenceImpl) animalType.getAttribute("mother").getOutgoingReferences().iterator().next(); + + // ID element reference + flightPartnerRefsColl = FlyingAnimal.flightPartnerRefsColl; + + ModelElementType flightPartnerRefType = modelInstance.getModel().getType(FlightPartnerRef.class); + flightPartnerRef = (FlightPartnerRef) modelInstance.getModelElementsByType(flightPartnerRefType).iterator().next(); + } + + @Test + public void testReferenceIdentifier() { + assertThat(fatherReference).hasIdentifier(tweety, daffy.getId()); + assertThat(motherReference).hasIdentifier(tweety, daisy.getId()); + assertThat(flightPartnerRefsColl).hasIdentifier(tweety, daffy.getId()); + } + + @Test + public void testReferenceTargetElement() { + assertThat(fatherReference).hasTargetElement(tweety, daffy); + assertThat(motherReference).hasTargetElement(tweety, daisy); + assertThat(flightPartnerRefsColl).hasTargetElement(tweety, daffy); + + fatherReference.setReferenceTargetElement(tweety, plucky); + motherReference.setReferenceTargetElement(tweety, birdo); + flightPartnerRefsColl.setReferenceTargetElement(flightPartnerRef, daisy); + + assertThat(fatherReference).hasTargetElement(tweety, plucky); + assertThat(motherReference).hasTargetElement(tweety, birdo); + assertThat(flightPartnerRefsColl).hasTargetElement(tweety, daisy); + } + + @Test + public void testReferenceTargetAttribute() { + Attribute idAttribute = animalType.getAttribute("id"); + assertThat(idAttribute).hasIncomingReferences(fatherReference, motherReference); + + assertThat(fatherReference).hasTargetAttribute(idAttribute); + assertThat(motherReference).hasTargetAttribute(idAttribute); + assertThat(flightPartnerRefsColl).hasTargetAttribute(idAttribute); + } + + @Test + public void testReferenceSourceAttribute() { + Attribute fatherAttribute = animalType.getAttribute("father"); + Attribute motherAttribute = animalType.getAttribute("mother"); + + assertThat(fatherReference).hasSourceAttribute(fatherAttribute); + assertThat(motherReference).hasSourceAttribute(motherAttribute); + } + + @Test + public void testRemoveReference() { + fatherReference.referencedElementRemoved(daffy, daffy.getId()); + + assertThat(fatherReference).hasNoTargetElement(tweety); + assertThat(tweety.getFather()).isNull(); + + motherReference.referencedElementRemoved(daisy, daisy.getId()); + assertThat(motherReference).hasNoTargetElement(tweety); + assertThat(tweety.getMother()).isNull(); + } + + @Test + public void testTargetElementsCollection() { + Collection referenceTargetElements = flightPartnerRefsColl.getReferenceTargetElements(tweety); + Collection flightPartners = Arrays.asList(new FlyingAnimal[]{birdo, daffy, daisy, plucky}); + + // directly test collection methods and not use the appropriate assertion methods + assertThat(referenceTargetElements.size()).isEqualTo(1); + assertThat(referenceTargetElements.isEmpty()).isFalse(); + assertThat(referenceTargetElements.contains(daffy)).isTrue(); + assertThat(referenceTargetElements.toArray()).isEqualTo(new Object[]{daffy}); + assertThat(referenceTargetElements.toArray(new FlyingAnimal[1])).isEqualTo(new FlyingAnimal[]{daffy}); + + assertThat(referenceTargetElements.add(daisy)).isTrue(); + assertThat(referenceTargetElements) + .hasSize(2) + .containsOnly(daffy, daisy); + + assertThat(referenceTargetElements.remove(daisy)).isTrue(); + assertThat(referenceTargetElements) + .hasSize(1) + .containsOnly(daffy); + + assertThat(referenceTargetElements.addAll(flightPartners)).isTrue(); + assertThat(referenceTargetElements.containsAll(flightPartners)).isTrue(); + assertThat(referenceTargetElements) + .hasSize(4) + .containsOnly(daffy, daisy, plucky, birdo); + + assertThat(referenceTargetElements.removeAll(flightPartners)).isTrue(); + assertThat(referenceTargetElements).isEmpty(); + + try { + referenceTargetElements.retainAll(flightPartners); + fail("retainAll method is not implemented"); + } + catch (Exception e) { + assertThat(e).isInstanceOf(UnsupportedModelOperationException.class); + } + + referenceTargetElements.addAll(flightPartners); + assertThat(referenceTargetElements).isNotEmpty(); + referenceTargetElements.clear(); + assertThat(referenceTargetElements).isEmpty(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/validation/IllegalBirdValidator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/validation/IllegalBirdValidator.java new file mode 100644 index 0000000000000000000000000000000000000000..d1e49410154ae0cd2133eb4a782b956ea281d4a6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/validation/IllegalBirdValidator.java @@ -0,0 +1,47 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.validation; + +import org.camunda.bpm.model.xml.testmodel.instance.Bird; + +/** + * @author Daniel Meyer + * + */ +public class IllegalBirdValidator implements ModelElementValidator { + + protected String nameOfBird; + + public IllegalBirdValidator(String nameOfBird) { + this.nameOfBird = nameOfBird; + } + + @Override + public Class getElementType() { + return Bird.class; + } + + @Override + public void validate(Bird bird, ValidationResultCollector validationResultCollector) { + + if(nameOfBird.equals(bird.getId())) { + validationResultCollector.addError(20, String.format("Bird %s is illegal", nameOfBird)); + } + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/validation/IsAdultWarner.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/validation/IsAdultWarner.java new file mode 100644 index 0000000000000000000000000000000000000000..e60c2d61e107257d89393302b8f82c8bafff2b0a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/validation/IsAdultWarner.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.validation; + +import org.camunda.bpm.model.xml.testmodel.instance.FlyingAnimal; + +/** + * @author Daniel Meyer + * + */ +public class IsAdultWarner implements ModelElementValidator { + + @Override + public Class getElementType() { + return FlyingAnimal.class; + } + + @Override + public void validate(FlyingAnimal element, ValidationResultCollector validationResultCollector) { + + if(element.getAge() == null || element.getAge() < 18) { + validationResultCollector.addWarning(10, "Is not an adult"); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/validation/ModelValidationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/validation/ModelValidationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..02618e7c46167fdf7c3709e1d5c25e8a915ad7c5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/validation/ModelValidationTest.java @@ -0,0 +1,178 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.validation; + +import static org.assertj.core.api.Assertions.*; + +import java.io.InputStream; +import java.io.StringWriter; +import java.util.List; +import org.camunda.bpm.model.xml.ModelInstance; +import org.camunda.bpm.model.xml.impl.validation.ModelValidationResultsImpl; +import org.camunda.bpm.model.xml.testmodel.TestModelParser; +import org.camunda.bpm.model.xml.testmodel.instance.Bird; +import org.junit.Before; +import org.junit.Test; + +/** + * @author Daniel Meyer + */ +public class ModelValidationTest { + + protected ModelInstance modelInstance; + + @Before + public void parseModel() { + TestModelParser modelParser = new TestModelParser(); + String testXml = "org/camunda/bpm/model/xml/testmodel/instance/UnknownAnimalTest.xml"; + InputStream testXmlAsStream = this.getClass().getClassLoader().getResourceAsStream(testXml); + + modelInstance = modelParser.parseModelFromStream(testXmlAsStream); + } + + @Test + public void shouldValidateWithEmptyList() { + ValidationResults results = modelInstance.validate(List.of()); + + assertThat(results).isNotNull(); + assertThat(results.hasErrors()).isFalse(); + } + + @Test + public void shouldCollectWarnings() { + List> validators = List.of(new IsAdultWarner()); + + ValidationResults results = modelInstance.validate(validators); + + assertThat(results).isNotNull(); + assertThat(results.hasErrors()).isFalse(); + assertThat(results.getErrorCount()).isEqualTo(0); + assertThat(results.getWarinigCount()).isEqualTo(7); + } + + @Test + public void shouldCollectErrors() { + List> validators = List.of(new IllegalBirdValidator("tweety")); + + ValidationResults results = modelInstance.validate(validators); + + assertThat(results).isNotNull(); + assertThat(results.hasErrors()).isTrue(); + assertThat(results.getErrorCount()).isEqualTo(1); + assertThat(results.getWarinigCount()).isEqualTo(0); + } + + @Test + public void shouldWriteResults() { + List> validators = List.of(new IllegalBirdValidator("tweety")); + + ValidationResults results = modelInstance.validate(validators); + + StringWriter stringWriter = new StringWriter(); + results.write(stringWriter, new TestResultFormatter()); + + assertThat(stringWriter.toString()).isEqualTo("tweety\n\tERROR (20): Bird tweety is illegal\n"); + } + + @Test + public void shouldWriteResultsUntilMaxSize() { + // Given + int maxSize = 120; + + // adds 7 elements with warnings of size 30, and an element prefix of size 8 + // total size for 1 warning = 38 + List> validators = List.of(new IsAdultWarner()); + + var results = modelInstance.validate(validators); + var stringWriter = new StringWriter(); + + // When + results.write(stringWriter, new TestResultFormatter(), maxSize); + + // it has enough size to print 3 warnings, but it will only print 2, + // because it needs to accommodate the suffix too in the max size. + assertThat(stringWriter.toString()) + .describedAs("2 lines for 2 element names, 2 line for 2 warnings and one for the suffix") + .hasLineCount(5) + .describedAs( + "shall contain only one error/warning and mention the count of the missing ones") + .endsWith(String.format(TestResultFormatter.OMITTED_RESULTS_SUFFIX_FORMAT, 5)); + } + + @Test + public void shouldCombineDifferentValidationResults() { + // Given + int maxSize = 120; + + // has 7 warnings + var results1 = modelInstance.validate(List.of(new IsAdultWarner())); + // has 1 error + var results2 = modelInstance.validate(List.of(new IllegalBirdValidator("tweety"))); + var stringWriter = new StringWriter(); + + // When + var results = new ModelValidationResultsImpl(results1, results2); + results.write(stringWriter, new TestResultFormatter(), maxSize); + + // it has enough size to print 3 warnings, but it will only print 2, + // because it needs to accommodate the suffix too in the max size. + assertThat(stringWriter.toString()) + .describedAs("2 lines for 2 element names, 2 line for 2 warnings and one for the suffix") + .hasLineCount(5) + .describedAs( + "shall contain only one error/warning and mention the count of the missing ones") + .endsWith(String.format(TestResultFormatter.OMITTED_RESULTS_SUFFIX_FORMAT, 6)); + } + + @Test + public void shouldReturnResults() { + List> validators = + List.of(new IllegalBirdValidator("tweety"), new IsAdultWarner()); + + ValidationResults results = modelInstance.validate(validators); + + assertThat(results.getErrorCount()).isEqualTo(1); + assertThat(results.getWarinigCount()).isEqualTo(7); + + var resultsByElement = results.getResults(); + assertThat(resultsByElement.size()).isEqualTo(7); + + for (var resultEntry : resultsByElement.entrySet()) { + Bird element = (Bird) resultEntry.getKey(); + List validationResults = resultEntry.getValue(); + assertThat(element).isNotNull(); + assertThat(validationResults).isNotNull(); + + if (element.getId().equals("tweety")) { + assertThat(validationResults.size()).isEqualTo(2); + ValidationResult error = validationResults.remove(0); + assertThat(error.getType()).isEqualTo(ValidationResultType.ERROR); + assertThat(error.getCode()).isEqualTo(20); + assertThat(error.getMessage()).isEqualTo("Bird tweety is illegal"); + assertThat(error.getElement()).isEqualTo(element); + } else { + assertThat(validationResults.size()).isEqualTo(1); + } + + ValidationResult warning = validationResults.get(0); + assertThat(warning.getType()).isEqualTo(ValidationResultType.WARNING); + assertThat(warning.getCode()).isEqualTo(10); + assertThat(warning.getMessage()).isEqualTo("Is not an adult"); + assertThat(warning.getElement()).isEqualTo(element); + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/validation/TestResultFormatter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/validation/TestResultFormatter.java new file mode 100644 index 0000000000000000000000000000000000000000..79d4cb86332e892b595dbc114b896d02b5f02775 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/java/org/camunda/bpm/model/xml/validation/TestResultFormatter.java @@ -0,0 +1,62 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.model.xml.validation; + +import java.io.StringWriter; +import java.util.Formatter; + +import org.camunda.bpm.model.xml.instance.ModelElementInstance; +import org.camunda.bpm.model.xml.testmodel.instance.FlyingAnimal; + +/** + * @author Daniel Meyer + */ +@SuppressWarnings("resource") +public class TestResultFormatter implements ValidationResultFormatter { + + public static final String OMITTED_RESULTS_SUFFIX_FORMAT = "and %d more errors and/or warnings"; + + @Override + public void formatElement(StringWriter writer, ModelElementInstance element) { + Formatter formatter = new Formatter(writer); + + if (element instanceof FlyingAnimal) { + formatter.format("%s\n", ((FlyingAnimal) element).getId()); + } else { + formatter.format("%s\n", element.getElementType().getTypeName()); + } + + formatter.flush(); + } + + @Override + public void formatResult(StringWriter writer, ValidationResult result) { + new Formatter(writer) + .format("\t%s (%d): %s\n", result.getType(), result.getCode(), result.getMessage()) + .flush(); + } + + @Override + public void formatSuffixWithOmittedResultsCount(StringWriter writer, int count) { + new Formatter(writer).format(OMITTED_RESULTS_SUFFIX_FORMAT, count).flush(); + } + + @Override + public int getFormattedSuffixWithOmittedResultsSize(int count) { + return String.format(OMITTED_RESULTS_SUFFIX_FORMAT, count).getBytes().length; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/impl/parser/ExternalSchemaAccess.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/impl/parser/ExternalSchemaAccess.xml new file mode 100644 index 0000000000000000000000000000000000000000..f6fd7546ca63779826f115db83d94d1b9f44a9c2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/impl/parser/ExternalSchemaAccess.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/impl/parser/FeatureSecureProcessing.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/impl/parser/FeatureSecureProcessing.xml new file mode 100644 index 0000000000000000000000000000000000000000..c97ef31775485fce95b290bb92240ee4b95ae670 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/impl/parser/FeatureSecureProcessing.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/impl/parser/XxeProcessing.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/impl/parser/XxeProcessing.xml new file mode 100644 index 0000000000000000000000000000000000000000..32d03dd5037a54497e09f2a7f5e0e41df0ea937b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/impl/parser/XxeProcessing.xml @@ -0,0 +1,14 @@ + + + ]> + + + + + egg1 egg2 &xxe; + egg3 + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/instance/DomTest.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/instance/DomTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..e0cae19d9feab71fdf8cf6fe40cf10c4db832ded --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/instance/DomTest.xml @@ -0,0 +1,6 @@ + + + ]]> + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/instance/ModelElementInstanceTest.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/instance/ModelElementInstanceTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..771d1173af4241542607dbb4741517f6c10870fb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/instance/ModelElementInstanceTest.xml @@ -0,0 +1,15 @@ + + + + + some text content + + some text content with outer line breaks + + + some text content with inner + line breaks + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/Testmodel.xsd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/Testmodel.xsd new file mode 100644 index 0000000000000000000000000000000000000000..ed36624fd099d37f070b323c49bfcfdfaf563096 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/Testmodel.xsd @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/AlternativeNsTest.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/AlternativeNsTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..8d5fc835e4049d32eef1e2d29618aa5028851fbd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/AlternativeNsTest.xml @@ -0,0 +1,19 @@ + + + + + wusch + + + zisch + + + flappy + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/AnimalTest.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/AnimalTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..10ac9b9d27369013d4c74df2af1ecf64b8f0d104 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/AnimalTest.xml @@ -0,0 +1,23 @@ + + + + + + + + + tweety-hedwig + tweety-birdo + tweety-plucky + tweety-fiffy + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/BirdTest.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/BirdTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..651189af9c1391252450a7f26b038d4938e6bd12 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/BirdTest.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + hedwig + + + egg1 + egg2 + + + egg1 egg2 + egg3 + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/FlyingAnimalTest.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/FlyingAnimalTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..0713b782fdb864d2c82980e5a2afbcf7bfb7294b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/FlyingAnimalTest.xml @@ -0,0 +1,20 @@ + + + + + hedwig + hedwig + birdo + plucky + fiffy + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/UnknownAnimalTest.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/UnknownAnimalTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..aa7c74d6c072769410e9e45ce0d88df30206fc5b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/testmodel/instance/UnknownAnimalTest.xml @@ -0,0 +1,23 @@ + + + + + + + tweety-hedwig + + + timmy + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/type/attribute/AttributeTest.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/type/attribute/AttributeTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..fb0a567037f385f1e921050643f48ee55600b6f8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/type/attribute/AttributeTest.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/type/child/ChildElementCollectionTest.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/type/child/ChildElementCollectionTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..f8fbfd89cff054d0c667a5c17398bfa72fc8b059 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/type/child/ChildElementCollectionTest.xml @@ -0,0 +1,15 @@ + + + + + daffy + daisy + plucky + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/type/reference/ReferenceTest.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/type/reference/ReferenceTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..ad893b32fdcafe07fadb8fce7bdf7ac00ec0e6a0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/model-api/xml-model/src/test/resources/org/camunda/bpm/model/xml/type/reference/ReferenceTest.xml @@ -0,0 +1,13 @@ + + + + + daffy + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/mvnw b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/mvnw new file mode 100644 index 0000000000000000000000000000000000000000..8d937f4c14f11f8c3aded556054af0b0097eaede --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/mvnw @@ -0,0 +1,308 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.2.0 +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "$(uname)" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home"; export JAVA_HOME + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=$(java-config --jre-home) + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --unix "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --unix "$CLASSPATH") +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] && + JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=$(which readlink) + if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then + if $darwin ; then + javaHome="$(dirname "\"$javaExecutable\"")" + javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac" + else + javaExecutable="$(readlink -f "\"$javaExecutable\"")" + fi + javaHome="$(dirname "\"$javaExecutable\"")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=$(cd "$wdir/.." || exit 1; pwd) + fi + # end of workaround + done + printf '%s' "$(cd "$basedir" || exit 1; pwd)" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' < "$1" + fi +} + +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR +log "$MAVEN_PROJECTBASEDIR" + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" +else + log "Couldn't find $wrapperJarPath, downloading it ..." + + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + fi + while IFS="=" read -r key value; do + # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' ) + safeValue=$(echo "$value" | tr -d '\r') + case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;; + esac + done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget > /dev/null; then + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + fi + else + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") + fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + log " - Compiling MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;; + esac +done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi +fi + +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --windows "$CLASSPATH") + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +# shellcheck disable=SC2086 # safe args +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/mvnw.cmd b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/mvnw.cmd new file mode 100644 index 0000000000000000000000000000000000000000..c4586b564e6fa1bc22ae740b1308b258581f1c35 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/mvnw.cmd @@ -0,0 +1,205 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.2.0 +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %WRAPPER_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/parent/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/parent/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..0e53846c68be187ae2302daec77e4e9155ef4050 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/parent/pom.xml @@ -0,0 +1,368 @@ + + 4.0.0 + + + org.camunda.bpm + camunda-root + 7.24.0-SNAPSHOT + ../ + + + camunda-parent + Camunda Platform - Parent Pom + 2013 + pom + + + This pom is the parent of all Camunda Platform projects. + Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/ + + + + 3.27.0 + 5.3.39 + 6.2.10 + 3.5.5 + 3.15.6.Final + 2.34 + + 2.0.1.Final + 4.0.22 + 21.3.12 + 71.1 + + 2.9.0 + 2.5.2 + 2.5.2 + 2.8.9 + 2.4.3 + 5.6.5.Final + 4.0.3 + 2.15.2 + 2.3.3 + 2.3.6 + 4.0.5 + 4.0.2 + 5.4.3 + 5.3.4 + 9.2.1 + + 1.7.26 + 1.2.11 + 4.13.1 + 2.9.1 + 5.10.0 + 2.27.2 + 1.16.0 + 2.3.10 + + 1.1.0 + 1.47 + + + 37.0.0.Final + 29.0.0.Final + + 26.0.1.Final + 18.0.4.Final + + 9.0.107 + 10.1.43 + + 1.1.10.Final + 2.2.2 + 4.10.0 + 2.3.31 + + 3.0.2.Final + 10.0.0 + + 1.12.1 + 20.14.0 + 10.7.0 + + + + version="[$(version;==;${camunda.spin.version.clean}),$(version;=+;${camunda.spin.version.clean}))" + version="[$(version;==;${camunda.connect.version.clean}),$(version;=+;${camunda.connect.version.clean}))" + version="[$(version;==;${camunda.commons.version.clean}),$(version;=+;${camunda.commons.version.clean}))" + version="[$(version;==;${camunda.osgi.version.clean}),$(version;=+;${camunda.osgi.version.clean}))" + version="[$(version;===;${camunda.osgi.version.clean}),$(version;==+;${camunda.osgi.version.clean}))" + [$(version;==;$(@)),$(version;+;$(@))) + + + + + + ${camunda.osgi.import.before.defaults}, + ${camunda.osgi.import.defaults}, + ${camunda.osgi.import.additional}, + * + + + false + ${camunda.osgi.export.pkg};${camunda.osgi.version};-noimport:=true + + ${camunda.artifact}* + + version=${project.version} + -split-package:=first + ${camunda.osgi.import.pkg} + + ${camunda.artifact} + false + Ignore-Package,Include-Resource,Private-Package,Bundle-DocURL + {maven-resources} + + 5.1.9 + + + + + + + org.camunda.bpm + camunda-bom + ${project.version} + pom + import + + + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + hourly + + ${project.build.directory} + + -Xmx968m -Duser.language=en -Duser.region=US -XX:+HeapDumpOnOutOfMemoryError + -XX:HeapDumpPath=${project.build.directory}/heap_dump.hprof + --add-opens=java.base/java.util=ALL-UNNAMED + --add-opens=java.base/java.lang=ALL-UNNAMED + true + + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.16 + + -Xmx968m + hourly + + + + + integration-test + verify + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.8 + + + org.apache.maven.plugins + maven-resources-plugin + 2.6 + + + + + org.apache.maven.plugins + maven-shade-plugin + + true + + + + package + + shade + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.8 + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + org.apache.felix + maven-bundle-plugin + ${plugin.version.maven-bundle} + + ${camunda.osgi.exclude.dependencies} + + ${project.name} + ${camunda.osgi.symbolic.name} + ${camunda.osgi.activator} + ${camunda.osgi.export} + ${camunda.osgi.import} + ${camunda.osgi.dynamic} + ${camunda.osgi.private.pkg} + camunda + ${project.version} + ${camunda.osgi.include.resource} + <_versionpolicy>${camunda.osgi.import.default.version} + <_removeheaders>${camunda.osgi.remove.headers} + <_failok>${camunda.osgi.failok} + ${camunda.osgi.export.service} + ${camunda.osgi.import.service} + ${camunda.osgi.embed} + + + ${project.version} + ${project.version} + ${project.version} + ${project.version} + + + + + org.codehaus.cargo + cargo-maven3-plugin + 1.10.20 + + + net.kennychua + maven-urlpoller-plugin + 1.0.3 + + + org.codehaus.mojo + sql-maven-plugin + 1.5 + + true + + + + org.codehaus.mojo + clirr-maven-plugin + 2.8 + + + org.codehaus.mojo + exec-maven-plugin + 1.4.0 + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + + org.apache.maven.plugins + maven-javadoc-plugin + + false + + -Xdoclint:none + --ignore-source-errors + + Camunda Platform Javadocs ${project.version} + Camunda Platform Javadocs ${project.version} + + + + + org.eclipse.transformer + transformer-maven-plugin + 0.5.0 + + + true + + jar:file:${org.camunda.bpm:camunda-engine:jar}!/META-INF/jakarta-renames.properties + jar:file:${org.camunda.bpm:camunda-engine:jar}!/META-INF/camunda-renames.properties + + + jakarta + + + + + com.github.eirslett + frontend-maven-plugin + ${version.eirslett.frontend.maven.plugin} + + v${version.nodejs} + ${version.npm} + + + + + org.springframework.boot + spring-boot-maven-plugin + + + 750 + + + + + + + + + license-header-check + + + + com.mycila + license-maven-plugin + + + + + + + + + JBoss public + jboss + https://repository.jboss.org/nexus/content/groups/public/ + + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + camunda services GmbH + http://www.camunda.com + + + http://www.camunda.org + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..ff586102bb3d2788bee1c57160454906e277c0f7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/pom.xml @@ -0,0 +1,378 @@ + + 4.0.0 + + + org.camunda + camunda-bpm-release-parent + 2.5.0 + + + + + org.camunda.bpm + camunda-root + 7.24.0-SNAPSHOT + pom + Camunda Platform - Root Pom + 2013 + + + This pom defines the modules that make up the build. + The parent pom for all Camunda Platform projects can be found in the parent directory relative to this file. + Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/ + + + + false + + + 3.5.15 + 2.12.5 + 4.3.0 + 1.19.3 + + + + + + org.codehaus.mojo + license-maven-plugin + 1.14 + + true + test + + + + + + + + + distro + + true + + + + spring-boot-starter + + quarkus-extension + + qa + + javaee/ejb-service + javaee/ejb-client + javaee/ejb-client-jakarta + javaee/jobexecutor-ra + javaee/jobexecutor-rar + + model-api + engine-dmn + connect + juel + spin + commons + freemarker-template-engine + + test-utils/testcontainers + test-utils/junit5-extension + test-utils/junit5-extension-dmn + test-utils/assert + test-utils/archunit + + engine + engine-cdi + engine-spring + engine-rest + + webapps + + examples + + engine-plugins + + distro/license-book + distro/jboss + distro/tomcat + distro/sql-script + distro/run + + clients/java + + internal-dependencies + database + parent + bom + + + + + distro-ce + + true + + + + spring-boot-starter + + distro/license-book + distro/jboss + distro/tomcat + distro/run + + + + + javadocs + + + + org.apache.maven.plugins + maven-javadoc-plugin + + (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= + 'https://ssgtm.camunda.org/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); + })(window,document,'script','dataLayer','GTM-PP9MHKW'); + ]]> + false + + -Xdoclint:none + --ignore-source-errors + --allow-script-in-comments + + Camunda Platform Javadocs ${project.version} + Camunda Platform Javadocs ${project.version} + + + + + + + + distro-serverless + + qa + + engine + engine-cdi + engine-spring + engine-rest + + webapps + + examples + + engine-plugins + + distro/sql-script + + internal-dependencies + database + parent + bom + + + + + distro-tomcat + + true + + + distro/license-book + distro/tomcat + + + + + distro-wildfly + + true + + + javaee/ejb-client + javaee/ejb-client-jakarta + distro/license-book + distro/wildfly + distro/wildfly26 + + + + + distro-webjar + + true + + + distro/webjar + + + + + distro-run + + true + + + distro/run + + + + + distro-starter + + + spring-boot-starter + + + + + + check-engine + + engine + engine-cdi + engine-spring + engine-rest + + internal-dependencies + database + parent + bom + + + + + + check-webapps + + internal-dependencies + parent + bom + + + + + central-sonatype-publish + + spring-boot-starter + quarkus-extension + model-api + + engine + engine-cdi + engine-spring + engine-rest + + engine-dmn + connect + juel + spin + commons + freemarker-template-engine + + javaee/ejb-client + javaee/ejb-client-jakarta + + webapps + + engine-plugins + + distro/webjar + + clients/java + + test-utils/junit5-extension + test-utils/junit5-extension-dmn + test-utils/assert + + internal-dependencies + database + parent + bom + + + + + license-header-check + + + + com.mycila + license-maven-plugin + + + + + + + + + + maven-central + Maven Central + https://repo1.maven.org/maven2 + + false + + + + + camunda-public-repository + Camunda Platform Maven Repository + https://artifacts.camunda.com/artifactory/public/ + + + + camunda-nexus + Camunda Nexus + https://artifacts.camunda.com/artifactory/internal + + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + camunda services GmbH + http://www.camunda.com + + + http://www.camunda.org + + + + camunda.org + Camunda Platform Community + camunda.org + http://camunda.org + + + + + https://github.com/camunda/camunda-bpm-platform + scm:git:git@github.com:camunda/camunda-bpm-platform.git + scm:git:git@github.com:camunda/camunda-bpm-platform.git + HEAD + + + + Jira + https://app.camunda.com/jira/browse/CAM/ + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/README.md b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/README.md new file mode 100644 index 0000000000000000000000000000000000000000..dddd2984590fa28c37ca28bc8d4c26c67caff390 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/README.md @@ -0,0 +1,47 @@ +Running Integration Tests +---------- +The integration testsuites are located under `qa/`. There you'll find a folder named XX-runtime for each server runtime we support. These projects are responsible for taking a runtime container distribution (ie. Apache Tomcat, Wildfly) and configuring it for integration testing. The actual integration tests are located in the `qa/integration-tests-engine` and `qa/integration-tests-webapps` modules. + * *integration-tests-engine*: This module contains an extensive testsuite that test the integration of the process engine within a particular runtime container. For example, such tests will ensure that if you use the Job Executor Service inside a Java EE Container, you get a proper CDI request context spanning multiple EJB invocations or that EE resource injection works as expected. These integration tests are executed in-container, using [JBoss Arquillian](http://arquillian.org/). + * *integration-tests-webapps*: This module tests the Camunda Platform webapplications inside the runtime containers. These integration tests run inside a client / server setting: the webapplication is deployed to the runtime container, the runtime container is started and the tests running inside a client VM perform requests against the deployed applications. + +In order to run the integration tests, first perform a full install build. Then navigate to the `qa` folder. + +We have different maven profiles for selecting +* *Runtime containers & environments*: tomcat, wildfly +* *The testsuite*: engine-integration, webapps-integration +* *The database*: h2,h2-xa,postgresql,postgresql-xa (XA is only supported on Wildfly atm) + +In order to configure the build, compose the profiles for runtime container, testsuite, database. Example: + +``` +mvn clean install -Pengine-integration,tomcat,h2 +``` + +Here's another example for using wildfly as the runtime container: + +``` +mvn clean install -Pengine-integration,wildfly,h2 +``` + +If you want to test against an XA database, just add the corresponding XA database profile to the mvn cmdline above. Example: + +``` +mvn clean install -Pengine-integration,wildfly,postgresql,postgresql-xa +``` + +You can select multiple testsuites but only a single database and a single runtime container. This is valid: + +``` +mvn clean install -Pengine-integration,webapps-integration,tomcat,postgresql +``` + +There is a special profile for Wildfly Application Server: + +* Domain mode: `mvn clean install -Pengine-integration,h2,wildfly-domain` + +### Running tests with the Maven Wrapper + +With `mvnw`, from the root of the project, +run: `./mvnw clean install -f qa/pom.xml -P${integration-test-id},${application-server-id},${database-id}` +where `${database-id}` is for example `h2`, `${application-server-id}` is for e.g. `wildfly,wildfly-domain`, +and `${integration-test-id}` can be either `engine-integration` or `webapps-integration`. \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/ensure-clean-db-plugin/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/ensure-clean-db-plugin/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..768b736d5203d3e49550df66586c24aa760ef773 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/ensure-clean-db-plugin/pom.xml @@ -0,0 +1,25 @@ + + 4.0.0 + camunda-qa-ensure-clean-db + jar + + + Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/ + + Camunda Platform - QA - ensure clean db plugin + + + camunda-qa + org.camunda.bpm.qa + 7.24.0-SNAPSHOT + + + + + org.camunda.bpm + camunda-engine + provided + + + + \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/ensure-clean-db-plugin/src/main/java/org/camunda/qa/impl/EnsureCleanDbPlugin.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/ensure-clean-db-plugin/src/main/java/org/camunda/qa/impl/EnsureCleanDbPlugin.java new file mode 100644 index 0000000000000000000000000000000000000000..d0cf11be481251bdaae140eee5fd3bc1b400cb15 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/ensure-clean-db-plugin/src/main/java/org/camunda/qa/impl/EnsureCleanDbPlugin.java @@ -0,0 +1,87 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.qa.impl; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.application.ProcessApplicationInterface; +import org.camunda.bpm.container.impl.plugin.BpmPlatformPlugin; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.impl.ManagementServiceImpl; +import org.camunda.bpm.engine.impl.management.DatabasePurgeReport; +import org.camunda.bpm.engine.impl.management.PurgeReport; +import org.camunda.bpm.engine.impl.persistence.deploy.cache.CachePurgeReport; + +import java.util.concurrent.atomic.AtomicInteger; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * @author Daniel Meyer + * @author Christopher Zell + */ +public class EnsureCleanDbPlugin implements BpmPlatformPlugin { + + protected static final String DATABASE_NOT_CLEAN = "Database was not clean!\n"; + protected static final String CACHE_IS_NOT_CLEAN = "Cache was not clean!\n"; + protected Logger logger = Logger.getLogger(EnsureCleanDbPlugin.class.getName()); + + private AtomicInteger counter = new AtomicInteger(); + + @Override + public void postProcessApplicationDeploy(ProcessApplicationInterface processApplication) { + counter.incrementAndGet(); + } + + @SuppressWarnings("resource") + @Override + public void postProcessApplicationUndeploy(ProcessApplicationInterface processApplication) { + // some tests deploy multiple PAs. => only clean DB after last PA is undeployed + // if the deployment fails for example during parsing the deployment counter was not incremented + // so we have to check if the counter is already zero otherwise we go into the negative values + // best example is TestWarDeploymentWithBrokenBpmnXml in integration-test-engine test suite + if(counter.get() == 0 || counter.decrementAndGet() == 0) { + + final ProcessEngine defaultProcessEngine = BpmPlatform.getDefaultProcessEngine(); + try { + logger.log(Level.INFO, "=== Ensure Clean Database ==="); + ManagementServiceImpl managementService = (ManagementServiceImpl) defaultProcessEngine.getManagementService(); + PurgeReport report = managementService.purge(); + + if (report.isEmpty()) { + logger.log(Level.INFO, "Clean DB and cache."); + } else { + StringBuilder builder = new StringBuilder(); + + DatabasePurgeReport databasePurgeReport = report.getDatabasePurgeReport(); + if (!databasePurgeReport.isEmpty()) { + builder.append(DATABASE_NOT_CLEAN).append(databasePurgeReport.getPurgeReportAsString()); + } + + CachePurgeReport cachePurgeReport = report.getCachePurgeReport(); + if (!cachePurgeReport.isEmpty()) { + builder.append(CACHE_IS_NOT_CLEAN).append(cachePurgeReport.getPurgeReportAsString()); + } + logger.log(Level.INFO, builder.toString()); + } + } + catch(Throwable e) { + logger.log(Level.SEVERE, "Could not clean DB:", e); + } + } + + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/ensure-clean-db-plugin/src/main/resources/META-INF/services/org.camunda.bpm.container.impl.plugin.BpmPlatformPlugin b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/ensure-clean-db-plugin/src/main/resources/META-INF/services/org.camunda.bpm.container.impl.plugin.BpmPlatformPlugin new file mode 100644 index 0000000000000000000000000000000000000000..581afd1597739cfb6e554dd47dcc01c0169278a9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/ensure-clean-db-plugin/src/main/resources/META-INF/services/org.camunda.bpm.container.impl.plugin.BpmPlatformPlugin @@ -0,0 +1 @@ +org.camunda.qa.impl.EnsureCleanDbPlugin \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..b80ae86140de8a3b536a0a958bc8196b1f44addf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/pom.xml @@ -0,0 +1,735 @@ + + 4.0.0 + + + Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/ + + + camunda-qa-integration-tests-engine + Camunda Platform - QA Integration Tests - Engine + + + org.camunda.bpm.qa + camunda-qa + 7.24.0-SNAPSHOT + + + + + org.wildfly.arquillian + 2.2.0.Final + + true + + + + + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-bom + ${version.shrinkwrap.resolvers} + pom + import + + + + org.jboss.arquillian + arquillian-bom + ${version.arquillian} + import + pom + + + + org.springframework + spring-framework-bom + ${version.spring.framework} + pom + import + + + + com.fasterxml.jackson + jackson-bom + ${version.jackson} + import + pom + + + + + + + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-depchain + test + pom + + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + org.jboss.arquillian.protocol + arquillian-protocol-servlet + test + + + + junit + junit + test + + + + org.jboss.spec + jboss-javaee-6.0 + pom + provided + + + xalan + org.apache.xalan + + + + + + javax.enterprise.concurrent + javax.enterprise.concurrent-api + 1.0 + provided + + + + org.camunda.bpm.javaee + camunda-ejb-client + provided + + + + org.camunda.bpm + camunda-engine-cdi + provided + + + camunda-engine + org.camunda.bpm + + + + + + + org.camunda.bpm + camunda-engine + provided + + + + org.camunda.bpm.dmn + camunda-engine-dmn + provided + + + de.odysseus.juel + juel-api + + + de.odysseus.juel + juel-spi + + + de.odysseus.juel + juel-impl + + + + + + org.camunda.bpm + camunda-engine-spring + provided + + + camunda-engine + org.camunda.bpm + + + + + + org.camunda.spin + camunda-spin-core + + + + org.camunda.spin + camunda-spin-dataformat-json-jackson + + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + + + + + org.camunda.bpm + camunda-bom + ${project.version} + pom + test + + + + org.camunda.bpm + camunda-core-internal-dependencies + ${project.version} + pom + test + + + + org.camunda.connect + camunda-connect-core + + + + + org.springframework + spring-context + + + org.springframework + spring-jdbc + + + org.springframework + spring-tx + + + org.springframework + spring-orm + + + org.springframework + spring-web + + + + + org.jboss.weld.servlet + weld-servlet + 2.4.8.Final + test + + + + + org.apache.groovy + groovy-jsr223 + test + + + + + + + + src/test/resources + true + + **/*.xml + **/*.properties + + + + src/test/resources + false + + **/*.xml + **/*.properties + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + create-test-jar + package + + test-jar + + + true + + org/camunda/bpm/integrationtest/util/TestConstants* + org/camunda/bpm/integrationtest/util/TestContainer* + org/camunda/bpm/integrationtest/util/TestProcessApplication* + + + + + + + + + + + + wildfly26 + + + + org.camunda.bpm.qa + camunda-qa-wildfly26-runtime + ${project.version} + provided + pom + + + ${wildfly.container.adapter.groupId} + wildfly-arquillian-container-managed + ${wildfly.container.adapter.version} + test + + + + + + src/test/resources-wildfly26 + true + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-test-source + generate-test-sources + + add-test-source + + + + src/test/java-wildfly26 + + + + + + + org.apache.maven.plugins + maven-resources-plugin + + + ${*} + + false + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + **/JobExecutorRequestContextLocalInvocationTest.java + **/*_OTHERS.java + **/SpringPAExpressionResolvingTest.java + **/SpringServletPALifecycleTest.java + **/TestManagedDomain_JBOSS.java + + **/TestWarDeploymentWithProcessEnginePlugin.java + **/TestWarDeploymentWithProcessEnginePlugin.exclude + + **/SpringServletPATimerStartEventExpressionTest.java + **/FeelEngineTest.java + + ${redirect.test.output} + + + + + + + + wildfly26-domain + + + + org.camunda.bpm.qa + camunda-qa-wildfly26-runtime + ${project.version} + provided + pom + + + ${wildfly.container.adapter.groupId} + wildfly-arquillian-container-domain-managed + ${wildfly.container.adapter.version} + test + + + + + + src/test/resources-wildfly26-domain + true + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-test-source + generate-test-sources + + add-test-source + + + + src/test/java-wildfly26 + + + + + + + org.apache.maven.plugins + maven-resources-plugin + + + ${*} + + false + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/TestManagedDomain_JBOSS.java + + ${redirect.test.output} + + + + + + + + wildfly26-servlet + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-test-source + generate-test-sources + + add-test-source + + + + src/test/java-wildfly26-servlet + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + **/cdi/** + **/ejb/** + **/context/** + **/jar/** + **/jboss/** + **/SpringPAExpressionResolvingTest.java + **/SpringServletPALifecycleTest.java + **/BusinessRuleTaskVersionTagTest.java + + **/TestWarDeploymentWithProcessEnginePlugin.java + + **/SpringServletPATimerStartEventExpressionTest.java + **/FeelEngineTest.java + + ${redirect.test.output} + + + + + + + + tomcat9 + + + + + org.camunda.bpm + camunda-core-internal-dependencies + ${project.version} + import + pom + + + org.jboss.bom + jboss-javaee-6.0-with-tools + 1.0.4.Final + import + pom + + + + + + + org.camunda.bpm.qa + camunda-qa-tomcat9-runtime + ${project.version} + provided + pom + + + + org.jboss.arquillian.container + arquillian-tomcat-managed-8 + 1.1.0.Final + test + + + + + + src/test/resources-tomcat + true + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-test-source + generate-test-sources + + add-test-source + + + + src/test/java-tomcat9 + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + **/ear/** + **/ejb/** + **/jar/** + **/transactions/** + **/jpa/** + + **/JobExecutorRequestContextTest.java + + **/TestWarDeploymentWithBrokenBpmnXml.java + **/TestDeploymentWithDroolsTaskFails.java + **/TestProcessEnginesXmlFails.java + + **/TestWarDeploymentWithProcessEnginePlugin.java + + **/*_JBOSS.java + **/EjbPALifecycleCallbacksTest.java + + **/PythonPaClassImportTest.java + + **/MigrationContextSwitchBeansTest.java + + **/ManagedJobExecutorTest.java + + ${redirect.test.output} + + + + + + + + distro + + true + + + + ${wildfly.container.adapter.groupId} + wildfly-arquillian-container-managed + ${wildfly.container.adapter.version} + test + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + ${redirect.test.output} + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-test-source + generate-test-sources + + add-test-source + + + + src/test/java-wildfly26 + + + + + add-test-resource + generate-test-resources + + add-test-resource + + + + + src/test/resources-wildfly26 + + + + + + + + + + + + ci + + + + org.apache.maven.plugins + maven-surefire-plugin + + + ../../settings.xml + + ${redirect.test.output} + + + + + + + + + clean-db + + + org.camunda.bpm + camunda-engine + test + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack-sql-scripts + generate-test-sources + + unpack + + + + + org.camunda.bpm + camunda-engine + ${project.build.directory}/sql-scripts/engine + true + + + + + + + + org.codehaus.mojo + sql-maven-plugin + + + drop-db-if-present + generate-test-sources + + execute + + + + + ${project.build.directory}/sql-scripts/engine/org/camunda/bpm/engine/db/drop/activiti.${database.type}.drop.decision.engine.sql + ${project.build.directory}/sql-scripts/engine/org/camunda/bpm/engine/db/drop/activiti.${database.type}.drop.case.engine.sql + ${project.build.directory}/sql-scripts/engine/org/camunda/bpm/engine/db/drop/activiti.${database.type}.drop.engine.sql + ${project.build.directory}/sql-scripts/engine/org/camunda/bpm/engine/db/drop/activiti.${database.type}.drop.identity.sql + ${project.build.directory}/sql-scripts/engine/org/camunda/bpm/engine/db/drop/activiti.${database.type}.drop.decision.history.sql + ${project.build.directory}/sql-scripts/engine/org/camunda/bpm/engine/db/drop/activiti.${database.type}.drop.case.history.sql + ${project.build.directory}/sql-scripts/engine/org/camunda/bpm/engine/db/drop/activiti.${database.type}.drop.history.sql + + true + continue + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat/org/camunda/bpm/integrationtest/util/TestConstants.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat/org/camunda/bpm/integrationtest/util/TestConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..15ab0b4f8d2326976d900f1c6ce046f82a2cd538 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat/org/camunda/bpm/integrationtest/util/TestConstants.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +/** + * @author Thorben Lindhauer + * + */ +public class TestConstants { + + public final static String APP_NAME = ""; + public final static String PROCESS_ENGINE_SERVICE_JNDI_NAME = "java:comp/env/ProcessEngineService"; + public final static String PROCESS_APPLICATION_SERVICE_JNDI_NAME = "java:comp/env/ProcessApplicationService"; + + public static String getAppName() { + return APP_NAME; + } + + public String getEngineService() { + return PROCESS_ENGINE_SERVICE_JNDI_NAME; + } + + public String getProcessApplicationService() { + return PROCESS_APPLICATION_SERVICE_JNDI_NAME; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat/org/camunda/bpm/integrationtest/util/TestContainer.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat/org/camunda/bpm/integrationtest/util/TestContainer.java new file mode 100644 index 0000000000000000000000000000000000000000..c64eceac8920701977329e75a5e6c9e30a041074 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat/org/camunda/bpm/integrationtest/util/TestContainer.java @@ -0,0 +1,88 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.jboss.shrinkwrap.api.spec.WebArchive; + +/** + * Tomcat test container. + * + * @author Daniel Meyer + */ +public class TestContainer { + + /** + * In some scenarios, Tomcat 10 and Weld 5 have issues when the Weld library is embedded into the WAR. + * To solve these issues, Weld is added to the Tomcat server libs folder. + */ + public static void addContainerSpecificResourcesEmbedCdiLib(WebArchive webArchive) { + addContainerSpecificResources(webArchive); + webArchive.addAsLibraries(DeploymentHelper.getWeld()); + } + + public static void addContainerSpecificResources(WebArchive webArchive) { + webArchive + .addAsManifestResource("context.xml") + .addClass(TestProcessApplication.class) + .addAsWebInfResource("web.xml"); + } + + public static void addContainerSpecificResourcesWithoutWeld(WebArchive webArchive) { + webArchive + .addAsManifestResource("context.xml") + .addClass(TestProcessApplication.class) + .addAsWebInfResource("web-without-weld.xml", "web.xml"); + } + + /** + * In some scenarios, Tomcat 10 and Weld 5 have issues when the Weld library is embedded into the WAR. + * To solve these issues, Weld is added to the Tomcat server libs folder. + */ + public static void addContainerSpecificResourcesForNonPaEmbedCdiLib(WebArchive webArchive) { + addContainerSpecificResourcesForNonPa(webArchive); + webArchive.addAsLibraries(DeploymentHelper.getWeld()); + } + + public static void addContainerSpecificResourcesForNonPa(WebArchive webArchive) { + webArchive + .addAsManifestResource("context.xml") + .addAsWebInfResource("web.xml"); + } + + public static void addContainerSpecificResourcesForNonPaWithoutWeld(WebArchive webArchive) { + webArchive + .addAsManifestResource("context.xml") + .addAsWebInfResource("web-without-weld.xml", "web.xml"); + } + + public static void addContainerSpecificProcessEngineConfigurationClass(WebArchive deployment) { + // nothing to do + } + + public static void addSpinJacksonJsonDataFormat(WebArchive webArchive) { + webArchive.addAsLibraries(DeploymentHelper.getSpinJacksonJsonDataFormatForServer("tomcat")); + } + + public static void addJodaTimeJacksonModule(WebArchive webArchive) { + webArchive.addAsLibraries(DeploymentHelper.getJodaTimeModuleForServer("tomcat")); + } + + public static void addCommonLoggingDependency(WebArchive webArchive) { + // nothing to do + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat/org/camunda/bpm/integrationtest/util/TestProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat/org/camunda/bpm/integrationtest/util/TestProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..31e54cf695c8befcaea5cc8bc08fc37a36becfca --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat/org/camunda/bpm/integrationtest/util/TestProcessApplication.java @@ -0,0 +1,30 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.camunda.bpm.application.ProcessApplication; +import org.camunda.bpm.application.impl.ServletProcessApplication; + +/** + * @author Daniel Meyer + * + */ +@ProcessApplication +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class TestProcessApplication extends org.camunda.bpm.application.impl.ServletProcessApplication { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat9/org/camunda/bpm/integrationtest/util/TestConstants.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat9/org/camunda/bpm/integrationtest/util/TestConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..15ab0b4f8d2326976d900f1c6ce046f82a2cd538 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat9/org/camunda/bpm/integrationtest/util/TestConstants.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +/** + * @author Thorben Lindhauer + * + */ +public class TestConstants { + + public final static String APP_NAME = ""; + public final static String PROCESS_ENGINE_SERVICE_JNDI_NAME = "java:comp/env/ProcessEngineService"; + public final static String PROCESS_APPLICATION_SERVICE_JNDI_NAME = "java:comp/env/ProcessApplicationService"; + + public static String getAppName() { + return APP_NAME; + } + + public String getEngineService() { + return PROCESS_ENGINE_SERVICE_JNDI_NAME; + } + + public String getProcessApplicationService() { + return PROCESS_APPLICATION_SERVICE_JNDI_NAME; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat9/org/camunda/bpm/integrationtest/util/TestContainer.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat9/org/camunda/bpm/integrationtest/util/TestContainer.java new file mode 100644 index 0000000000000000000000000000000000000000..083bd28951a215275184c2d302022d171e09251e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat9/org/camunda/bpm/integrationtest/util/TestContainer.java @@ -0,0 +1,88 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.jboss.shrinkwrap.api.spec.WebArchive; + +/** + * Tomcat test container. + * + * @author Daniel Meyer + */ +public class TestContainer { + + /** + * In some scenarios, Tomcat 10 and Weld 5 have issues when the Weld library is embedded into the WAR. + * To solve these issues, Weld is added to the Tomcat server libs folder. + */ + public static void addContainerSpecificResourcesEmbedCdiLib(WebArchive webArchive) { + addContainerSpecificResources(webArchive); + } + + public static void addContainerSpecificResources(WebArchive webArchive) { + webArchive + .addAsManifestResource("context.xml") + .addClass(TestProcessApplication.class) + .addAsWebInfResource("web.xml") + .addAsLibraries(DeploymentHelper.getWeld()); + } + + public static void addContainerSpecificResourcesWithoutWeld(WebArchive webArchive) { + webArchive + .addAsManifestResource("context.xml") + .addClass(TestProcessApplication.class) + .addAsWebInfResource("web-without-weld.xml", "web.xml"); + } + + /** + * In some scenarios, Tomcat 10 and Weld 5 have issues when the Weld library is embedded into the WAR. + * To solve these issues, Weld is added to the Tomcat server libs folder. + */ + public static void addContainerSpecificResourcesForNonPaEmbedCdiLib(WebArchive webArchive) { + addContainerSpecificResourcesForNonPa(webArchive); + } + + public static void addContainerSpecificResourcesForNonPa(WebArchive webArchive) { + webArchive + .addAsManifestResource("context.xml") + .addAsWebInfResource("web.xml") + .addAsLibraries(DeploymentHelper.getWeld()); + } + + public static void addContainerSpecificResourcesForNonPaWithoutWeld(WebArchive webArchive) { + webArchive + .addAsManifestResource("context.xml") + .addAsWebInfResource("web-without-weld.xml", "web.xml"); + } + + public static void addContainerSpecificProcessEngineConfigurationClass(WebArchive deployment) { + // nothing to do + } + + public static void addSpinJacksonJsonDataFormat(WebArchive webArchive) { + webArchive.addAsLibraries(DeploymentHelper.getSpinJacksonJsonDataFormatForServer("tomcat")); + } + + public static void addJodaTimeJacksonModule(WebArchive webArchive) { + webArchive.addAsLibraries(DeploymentHelper.getJodaTimeModuleForServer("tomcat")); + } + + public static void addCommonLoggingDependency(WebArchive webArchive) { + // nothing to do + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat9/org/camunda/bpm/integrationtest/util/TestProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat9/org/camunda/bpm/integrationtest/util/TestProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..31e54cf695c8befcaea5cc8bc08fc37a36becfca --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-tomcat9/org/camunda/bpm/integrationtest/util/TestProcessApplication.java @@ -0,0 +1,30 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.camunda.bpm.application.ProcessApplication; +import org.camunda.bpm.application.impl.ServletProcessApplication; + +/** + * @author Daniel Meyer + * + */ +@ProcessApplication +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class TestProcessApplication extends org.camunda.bpm.application.impl.ServletProcessApplication { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26-servlet/org/camunda/bpm/integrationtest/util/TestConstants.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26-servlet/org/camunda/bpm/integrationtest/util/TestConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..0319a14bea8284c695600ff8f5c7ff506380de8d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26-servlet/org/camunda/bpm/integrationtest/util/TestConstants.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.camunda.bpm.BpmPlatform; + +/** + * @author Thorben Lindhauer + * + */ +public class TestConstants { + +public final static String APP_NAME = ""; + + public final static String PROCESS_ENGINE_SERVICE_JNDI_NAME = BpmPlatform.PROCESS_ENGINE_SERVICE_JNDI_NAME; + public final static String PROCESS_APPLICATION_SERVICE_JNDI_NAME = BpmPlatform.PROCESS_APPLICATION_SERVICE_JNDI_NAME; + + public static String getAppName() { + return APP_NAME; + } + + public String getEngineService() { + return PROCESS_ENGINE_SERVICE_JNDI_NAME; + } + + public String getProcessApplicationService() { + return PROCESS_APPLICATION_SERVICE_JNDI_NAME; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26-servlet/org/camunda/bpm/integrationtest/util/TestContainer.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26-servlet/org/camunda/bpm/integrationtest/util/TestContainer.java new file mode 100644 index 0000000000000000000000000000000000000000..48c9f046f3f37f6be3021aed869c46a94b5d7dba --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26-servlet/org/camunda/bpm/integrationtest/util/TestContainer.java @@ -0,0 +1,69 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.jboss.shrinkwrap.api.spec.WebArchive; + + + +/** + * + * @author christian.lipphardt + */ +public class TestContainer { + + public static void addContainerSpecificResourcesEmbedCdiLib(WebArchive webArchive) { + addContainerSpecificResources(webArchive); + } + + public static void addContainerSpecificResources(WebArchive archive) { + addContainerSpecificResourcesWithoutWeld(archive); + } + + public static void addContainerSpecificResourcesWithoutWeld(WebArchive webArchive) { + webArchive.addClass(TestProcessApplication.class); + } + + public static void addContainerSpecificResourcesForNonPaEmbedCdiLib(WebArchive webArchive) { + addContainerSpecificResourcesForNonPa(webArchive); + } + + public static void addContainerSpecificResourcesForNonPa(WebArchive webArchive) { + addContainerSpecificResourcesForNonPaWithoutWeld(webArchive); + } + + public static void addContainerSpecificResourcesForNonPaWithoutWeld(WebArchive webArchive) { + webArchive.addAsManifestResource("jboss-deployment-structure.xml"); + } + + public static void addContainerSpecificProcessEngineConfigurationClass(WebArchive deployment) { + // nothing to do + } + + public static void addSpinJacksonJsonDataFormat(WebArchive webArchive) { + webArchive.addAsManifestResource("jboss-deployment-structure-spin-json.xml", "jboss-deployment-structure.xml"); + } + + public static void addJodaTimeJacksonModule(WebArchive webArchive) { + webArchive.addAsLibraries(DeploymentHelper.getJodaTimeModuleForServer("jboss")); + } + + public static void addCommonLoggingDependency(WebArchive webArchive) { + webArchive.addAsManifestResource("jboss-deployment-structure-with-commons-logging.xml", "jboss-deployment-structure.xml"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26-servlet/org/camunda/bpm/integrationtest/util/TestProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26-servlet/org/camunda/bpm/integrationtest/util/TestProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..c7f2923aa25c2fa4178d30b0ce800446dfa84bd4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26-servlet/org/camunda/bpm/integrationtest/util/TestProcessApplication.java @@ -0,0 +1,30 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.camunda.bpm.application.ProcessApplication; +import org.camunda.bpm.application.impl.ServletProcessApplication; + +/** + * @author meyerd + * + */ +@ProcessApplication +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class TestProcessApplication extends org.camunda.bpm.application.impl.ServletProcessApplication { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26/org/camunda/bpm/integrationtest/util/TestConstants.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26/org/camunda/bpm/integrationtest/util/TestConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..8d44c9d5869d8630c17c7bd3dfc81123c69ea532 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26/org/camunda/bpm/integrationtest/util/TestConstants.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.camunda.bpm.BpmPlatform; + +/** + * @author Thorben Lindhauer + * + */ +public class TestConstants { + + public final static String APP_NAME = ""; + + public final static String PROCESS_ENGINE_SERVICE_JNDI_NAME = BpmPlatform.PROCESS_ENGINE_SERVICE_JNDI_NAME; + public final static String PROCESS_APPLICATION_SERVICE_JNDI_NAME = BpmPlatform.PROCESS_APPLICATION_SERVICE_JNDI_NAME; + + public static String getAppName() { + return APP_NAME; + } + + public String getEngineService() { + return PROCESS_ENGINE_SERVICE_JNDI_NAME; + } + + public String getProcessApplicationService() { + return PROCESS_APPLICATION_SERVICE_JNDI_NAME; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26/org/camunda/bpm/integrationtest/util/TestContainer.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26/org/camunda/bpm/integrationtest/util/TestContainer.java new file mode 100644 index 0000000000000000000000000000000000000000..4a5f1ce6bf2f0eba9a4fb306ff8857e401ed217c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26/org/camunda/bpm/integrationtest/util/TestContainer.java @@ -0,0 +1,67 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.jboss.shrinkwrap.api.spec.WebArchive; + + +/** + * + * @author christian.lipphardt + */ +public class TestContainer { + + public static void addContainerSpecificResourcesEmbedCdiLib(WebArchive webArchive) { + addContainerSpecificResources(webArchive); + } + + public static void addContainerSpecificResources(WebArchive webArchive) { + addContainerSpecificResourcesWithoutWeld(webArchive); + } + + public static void addContainerSpecificResourcesWithoutWeld(WebArchive webArchive) { + webArchive.addAsLibraries(DeploymentHelper.getEjbClient()); + } + + public static void addContainerSpecificResourcesForNonPaEmbedCdiLib(WebArchive webArchive) { + addContainerSpecificResourcesForNonPa(webArchive); + } + + public static void addContainerSpecificResourcesForNonPa(WebArchive webArchive) { + addContainerSpecificResourcesForNonPaWithoutWeld(webArchive); + } + + public static void addContainerSpecificResourcesForNonPaWithoutWeld(WebArchive webArchive) { + webArchive.addAsManifestResource("jboss-deployment-structure.xml"); + } + + public static void addContainerSpecificProcessEngineConfigurationClass(WebArchive deployment) { + // nothing to do + } + + public static void addSpinJacksonJsonDataFormat(WebArchive webArchive) { + webArchive.addAsManifestResource("jboss-deployment-structure-spin-json.xml", "jboss-deployment-structure.xml"); + } + + public static void addJodaTimeJacksonModule(WebArchive webArchive) { + webArchive.addAsLibraries(DeploymentHelper.getJodaTimeModuleForServer("jboss")); + } + + public static void addCommonLoggingDependency(WebArchive webArchive) { + webArchive.addAsManifestResource("jboss-deployment-structure-with-commons-logging.xml", "jboss-deployment-structure.xml"); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26/org/camunda/bpm/integrationtest/util/TestProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26/org/camunda/bpm/integrationtest/util/TestProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..7cf24e091d69620495f26169a1ce34835ffb27df --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java-wildfly26/org/camunda/bpm/integrationtest/util/TestProcessApplication.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.camunda.bpm.application.ProcessApplication; + +/** + * @author meyerd + * + */ +@ProcessApplication +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class TestProcessApplication extends org.camunda.bpm.application.impl.ServletProcessApplication { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/EjbPALifecycleCallbacksTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/EjbPALifecycleCallbacksTest.java new file mode 100644 index 0000000000000000000000000000000000000000..68fe5c76504b26a3b66f79e15c0ca109cf230e09 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/EjbPALifecycleCallbacksTest.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.callbacks; + +import org.camunda.bpm.integrationtest.deployment.callbacks.apps.CustomEjbProcessApplication; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class EjbPALifecycleCallbacksTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createDeployment() { + + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war") + .addClass(CustomEjbProcessApplication.class) + .addClass(AbstractFoxPlatformIntegrationTest.class); + + return archive; + + } + + @Test + public void testPaLifecycleCallbacks() { + // if we get here, everything is all right :) + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/PostDeployInjectDefaultEngineTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/PostDeployInjectDefaultEngineTest.java new file mode 100644 index 0000000000000000000000000000000000000000..018e0fe45a8a12eaa4cfb72d114840d24823a08e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/PostDeployInjectDefaultEngineTest.java @@ -0,0 +1,62 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.callbacks; + +import java.util.List; + +import org.junit.Assert; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.integrationtest.deployment.callbacks.apps.PostDeployInjectApp; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class PostDeployInjectDefaultEngineTest { + + @Deployment + public static WebArchive createDeployment() { + + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war") + .addClass(PostDeployInjectApp.class); + + return archive; + + } + + @Test + public void test() { + Assert.assertNotNull("processEngine must be injected", PostDeployInjectApp.processEngine); + Assert.assertNotNull("processApplicationInfo must be injected", PostDeployInjectApp.processApplicationInfo); + + List processEngines = PostDeployInjectApp.processEngines; + Assert.assertNotNull("processEngines must be injected", processEngines); + + // the app did no do a deployment so no engines are in the list + Assert.assertEquals(0, processEngines.size()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/TestPostDeployFailure_JBOSS.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/TestPostDeployFailure_JBOSS.java new file mode 100644 index 0000000000000000000000000000000000000000..8521f2ad99828137882b28afba0a4a8a8ce9e07a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/TestPostDeployFailure_JBOSS.java @@ -0,0 +1,67 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.callbacks; + +import org.junit.Assert; + +import org.camunda.bpm.integrationtest.deployment.callbacks.apps.PostDeployFailureApp; +import org.jboss.arquillian.container.test.api.Deployer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestPostDeployFailure_JBOSS { + + private static final String DEPLOYMENT = "DEPLOYMENT"; + + @ArquillianResource + private Deployer deployer; + + @Deployment(managed=false, name=DEPLOYMENT) + public static WebArchive createDeployment1() { + + WebArchive archive = ShrinkWrap.create(WebArchive.class, "failingDeployment.war") + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addAsResource("org/camunda/bpm/integrationtest/invoice-it.bpmn20.xml") + .addClass(PostDeployFailureApp.class); + + return archive; + + } + + @Test + public void test() { + + try { + deployer.deploy(DEPLOYMENT); + Assert.fail("failure expected"); + } catch (Exception e) { + // expected + } + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/TestPostDeployFailure_OTHERS.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/TestPostDeployFailure_OTHERS.java new file mode 100644 index 0000000000000000000000000000000000000000..83b315a0628c554e83d2cdd632d1b0768779db29 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/TestPostDeployFailure_OTHERS.java @@ -0,0 +1,62 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.callbacks; + +import org.junit.Assert; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +@Ignore +public class TestPostDeployFailure_OTHERS extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name="fail") + public static WebArchive createDeployment1() { + return TestPostDeployFailure_JBOSS.createDeployment1(); + } + + @Deployment(name="checker") + public static WebArchive createDeployment2() { + return initWebArchiveDeployment("checker.war"); + } + + @Test + @OperateOnDeployment("checker") + public void test() { + + // make sure the deployment of the first app was rolled back + + long count = processEngine.getRepositoryService() + .createDeploymentQuery() + .count(); + + Assert.assertEquals(1, count); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/apps/CustomEjbProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/apps/CustomEjbProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..ccd3b8af6c85f9d34cdf7ec636f7f7fdea295f37 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/apps/CustomEjbProcessApplication.java @@ -0,0 +1,59 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.callbacks.apps; + +import javax.ejb.ConcurrencyManagement; +import javax.ejb.ConcurrencyManagementType; +import javax.ejb.Local; +import javax.ejb.Singleton; +import javax.ejb.Startup; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; + +import org.camunda.bpm.application.PostDeploy; +import org.camunda.bpm.application.PreUndeploy; +import org.camunda.bpm.application.ProcessApplication; +import org.camunda.bpm.application.ProcessApplicationInterface; +import org.camunda.bpm.engine.ProcessEngine; +import org.junit.Assert; + +/** + * Custom {@link org.camunda.bpm.application.impl.EjbProcessApplication} with PA lifecycle callbacks + * + * @author Daniel Meyer + * + */ +@Singleton +@Startup +@ConcurrencyManagement(ConcurrencyManagementType.BEAN) +@TransactionAttribute(TransactionAttributeType.REQUIRED) +@ProcessApplication +@Local(ProcessApplicationInterface.class) +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class CustomEjbProcessApplication extends org.camunda.bpm.application.impl.EjbProcessApplication { + + @PostDeploy + public void postDeploy(ProcessEngine processEngine) { + Assert.assertNotNull(processEngine); + } + + @PreUndeploy + public void preUnDeploy(ProcessEngine processEngine) { + Assert.assertNotNull(processEngine); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/apps/PostDeployFailureApp.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/apps/PostDeployFailureApp.java new file mode 100644 index 0000000000000000000000000000000000000000..ebc6961123a81432d66fe067e2dc052d65250a1f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/apps/PostDeployFailureApp.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.callbacks.apps; + +import org.camunda.bpm.application.PostDeploy; +import org.camunda.bpm.application.ProcessApplication; + +@ProcessApplication +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class PostDeployFailureApp extends org.camunda.bpm.application.impl.ServletProcessApplication { + + @PostDeploy + public void fail() { + throw new RuntimeException("expected exception"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/apps/PostDeployInjectApp.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/apps/PostDeployInjectApp.java new file mode 100644 index 0000000000000000000000000000000000000000..e0962ae6ca79f0b56e7aa528c54b715930e84219 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/callbacks/apps/PostDeployInjectApp.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.callbacks.apps; + +import java.util.List; + +import org.camunda.bpm.application.PostDeploy; +import org.camunda.bpm.application.ProcessApplication; +import org.camunda.bpm.application.ProcessApplicationInfo; +import org.camunda.bpm.engine.ProcessEngine; + +@ProcessApplication +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class PostDeployInjectApp extends org.camunda.bpm.application.impl.ServletProcessApplication { + + public static ProcessEngine processEngine; + public static ProcessApplicationInfo processApplicationInfo; + public static List processEngines; + + @PostDeploy + public void injectDefaultEngine(ProcessEngine processEngine, List processEngines, ProcessApplicationInfo processApplicationInfo) { + PostDeployInjectApp.processEngine = processEngine; + PostDeployInjectApp.processEngines = processEngines; + PostDeployInjectApp.processApplicationInfo = processApplicationInfo; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/CustomProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/CustomProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..60324c0357927ead5f9dc2d0a64b2da9d4f3e922 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/CustomProcessApplication.java @@ -0,0 +1,32 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.cfg; + +import org.camunda.bpm.application.ProcessApplication; + +/** + * @author Daniel Meyer + * + */ +@ProcessApplication( + deploymentDescriptors = {"my/alternate/location/processes.xml"} +) +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class CustomProcessApplication extends org.camunda.bpm.application.impl.ServletProcessApplication { + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/DummyProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/DummyProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..f1df03be6802edd8e475aef216531a2904bee36d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/DummyProcessApplication.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.cfg; + +import org.camunda.bpm.application.ProcessApplication; + +/** + * @author Sebastian Menski + */ +@ProcessApplication +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class DummyProcessApplication extends org.camunda.bpm.application.impl.ServletProcessApplication { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/TestAdditionalResourceSuffixes.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/TestAdditionalResourceSuffixes.java new file mode 100644 index 0000000000000000000000000000000000000000..b63955602198c276bf93db597e528fd70f1326fe --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/TestAdditionalResourceSuffixes.java @@ -0,0 +1,77 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.cfg; + +import java.util.List; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; +import org.camunda.bpm.engine.repository.Resource; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +/** + * @author Sebastian Menski + */ +@RunWith(Arquillian.class) +public class TestAdditionalResourceSuffixes extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource("org/camunda/bpm/integrationtest/deployment/cfg/processes-additional-resource-suffixes.xml", "META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(DummyProcessApplication.class) + .addAsResource("org/camunda/bpm/integrationtest/deployment/cfg/invoice-it.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/cfg/hello.groovy") + .addAsResource("org/camunda/bpm/integrationtest/deployment/cfg/hello.py"); + + return archive; + } + + @Test + public void testDeployProcessArchive() { + assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + + ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("invoice-it"); + + assertEquals(1, processDefinitionQuery.count()); + ProcessDefinition processDefinition = processDefinitionQuery.singleResult(); + + String deploymentId = repositoryService.createDeploymentQuery() + .deploymentId(processDefinition.getDeploymentId()) + .singleResult() + .getId(); + List deploymentResources = repositoryService.getDeploymentResources(deploymentId); + assertEquals(3, deploymentResources.size()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/TestCustomProcessesXmlFileLocation.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/TestCustomProcessesXmlFileLocation.java new file mode 100644 index 0000000000000000000000000000000000000000..db75dcd86289edf072652ec90e5ba2bcb1d3fdf0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/TestCustomProcessesXmlFileLocation.java @@ -0,0 +1,67 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.cfg; + +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + *

This test ensures that we can use a custom location for the processes.xml file.

+ * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestCustomProcessesXmlFileLocation extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource("org/camunda/bpm/integrationtest/deployment/cfg/processes.xml", "my/alternate/location/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(CustomProcessApplication.class) + .addAsResource("org/camunda/bpm/integrationtest/deployment/cfg/invoice-it.bpmn20.xml"); + + return archive; + + } + + @Test + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("invoice-it") + .count(); + + Assert.assertEquals(1, count); + } + + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/TestDeploymentSource.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/TestDeploymentSource.java new file mode 100644 index 0000000000000000000000000000000000000000..beec5ac41752a281ab6be356e24947ca3f5557f5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/TestDeploymentSource.java @@ -0,0 +1,53 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.cfg; + +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.repository.ProcessApplicationDeployment; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Roman Smirnov + * + */ +@RunWith(Arquillian.class) +public class TestDeploymentSource extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/deployment/cfg/invoice-it.bpmn20.xml"); + } + + @Test + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + + org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery().singleResult(); + + Assert.assertNotNull(deployment); + Assert.assertEquals(ProcessApplicationDeployment.PROCESS_APPLICATION_DEPLOYMENT_SOURCE, deployment.getSource()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/TestDeploymentTenantId.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/TestDeploymentTenantId.java new file mode 100644 index 0000000000000000000000000000000000000000..54476fd950d6a96f02d8b3857aacf5af80a023b8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/cfg/TestDeploymentTenantId.java @@ -0,0 +1,59 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.cfg; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class TestDeploymentTenantId extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource("org/camunda/bpm/integrationtest/deployment/cfg/processes-with-tenant-id.xml", "META-INF/processes.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/cfg/invoice-it.bpmn20.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(DummyProcessApplication.class); + } + + @Test + public void testDeployProcessArchiveWithTenantId() { + assertThat(processEngine, is(notNullValue())); + + org.camunda.bpm.engine.repository.Deployment deployment = processEngine + .getRepositoryService() + .createDeploymentQuery() + .singleResult(); + + assertThat(deployment, is(notNullValue())); + assertThat(deployment.getTenantId(), is("tenant1")); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestFoxPlatformClientAsEjbModule_onePaAsLib.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestFoxPlatformClientAsEjbModule_onePaAsLib.java new file mode 100644 index 0000000000000000000000000000000000000000..c83b963c32a590b301db80c291257e8ba3f0a296 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestFoxPlatformClientAsEjbModule_onePaAsLib.java @@ -0,0 +1,97 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.ear; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; +import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * This test verifies that a process archive packaging the Camunda Platform client + * can be packaged inside an EAR application. + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestFoxPlatformClientAsEjbModule_onePaAsLib extends AbstractFoxPlatformIntegrationTest { + + /** + * Deployment layout + * + * test-application.ear + * |-- lib / + * |-- processes.jar + * |-- META-INF/processes.xml + * |-- org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml + * + * |-- fox-platform-client.jar <<===============================|| + * || Class-Path reference + * |-- test.war (contains the test-class but also processes) || + * |-- META-INF/MANIFEST.MF =================================|| + * |-- WEB-INF/beans.xml + * |-- + test classes + * + */ + @Deployment + public static EnterpriseArchive onePaAsLib() { + + JavaArchive processArchiveJar = ShrinkWrap.create(JavaArchive.class, "processes.jar") + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml") + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml"); + + JavaArchive foxPlatformClientJar = DeploymentHelper.getEjbClient(); + + WebArchive testJar = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .setManifest(new ByteArrayAsset(("Class-Path: " + foxPlatformClientJar.getName()+"\n").getBytes())) + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TestFoxPlatformClientAsEjbModule_onePaAsLib.class); + + return ShrinkWrap.create(EnterpriseArchive.class, "onePaAsLib.ear") + .addAsLibrary(processArchiveJar) + .addAsModule(foxPlatformClientJar) + .addAsModule(testJar) + .addAsLibrary(DeploymentHelper.getEngineCdi()); + } + + @Test + public void testOnePaAsLib() { + ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class); + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchive") + .count(); + + Assert.assertEquals(1, count); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestFoxPlatformClientAsEjbModule_pasAsEjbModule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestFoxPlatformClientAsEjbModule_pasAsEjbModule.java new file mode 100644 index 0000000000000000000000000000000000000000..4c4bd105dd521c0867aee98c4617729d4207dc2d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestFoxPlatformClientAsEjbModule_pasAsEjbModule.java @@ -0,0 +1,97 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.ear; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.integrationtest.deployment.ear.beans.EeComponent; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * This test verifies that a process archive packaging the Camunda Platform client + * can be packaged inside an EAR application. + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestFoxPlatformClientAsEjbModule_pasAsEjbModule extends AbstractFoxPlatformIntegrationTest { + + + /** + * This only works if EAR classloader isolation is turned OFF (which is the default in WildFly) + * + * test-application.ear + * |-- pa.jar + * |-- META-INF/processes.xml + * |-- org/camunda/bpm/integrationtest/deployment/ear/paAsEjbModule-process.bpmn20.xml + * + * |-- fox-platform-client.jar + * |-- META-INF/MANIFEST.MF + * + * |-- test.war + * |-- META-INF/MANIFEST.MF + * |-- WEB-INF/beans.xml + * |-- + test classes + * + */ + @Deployment + public static EnterpriseArchive paAsEjbModule() throws Exception { + + JavaArchive processArchive1Jar = ShrinkWrap.create(JavaArchive.class, "pa.jar") + .addClass(EeComponent.class) // need to add at least one EE component, otherwise the jar is not detected as an EJB module by Jboss AS + .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/paAsEjbModule-process.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/paAsEjbModule-pa.xml", "META-INF/processes.xml"); + + JavaArchive foxPlatformClientJar = DeploymentHelper.getEjbClient(); + + WebArchive testJar = ShrinkWrap.create(WebArchive.class, "paAsEjbModule-test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TestFoxPlatformClientAsEjbModule_pasAsEjbModule.class); + + return ShrinkWrap.create(EnterpriseArchive.class, "paAsEjbModule.ear") + .addAsModule(processArchive1Jar) + .addAsModule(foxPlatformClientJar) + .addAsModule(testJar) + .addAsLibrary(DeploymentHelper.getEngineCdi()); + } + + @Test + public void testPaAsEjbModule() { + ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class); + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("paAsEjbModule-process") + .count(); + Assert.assertEquals(1, count); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestFoxPlatformClientAsEjbModule_twoPasAsLib.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestFoxPlatformClientAsEjbModule_twoPasAsLib.java new file mode 100644 index 0000000000000000000000000000000000000000..dd1c59a2b6d6a6fdd9eac88d427ce8e2608e7dc5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestFoxPlatformClientAsEjbModule_twoPasAsLib.java @@ -0,0 +1,110 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.ear; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; +import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * This test verifies that a process archive packaging the Camunda Platform client + * can be packaged inside an EAR application. + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestFoxPlatformClientAsEjbModule_twoPasAsLib extends AbstractFoxPlatformIntegrationTest { + + + /** + * Deployment layout + * + * test-application.ear + * |-- lib / + * |-- processes1.jar + * |-- META-INF/processes.xml + * |-- org/camunda/bpm/integrationtest/deployment/ear/process1.bpmn20.xml + * |-- processes2.jar + * |-- META-INF/processes.xml + * |-- org/camunda/bpm/integrationtest/deployment/ear/process2.bpmn20.xml + * + * |-- fox-platform-client.jar <<===============================|| + * || Class-Path reference + * |-- test.war (contains the test-class but also processes) || + * |-- META-INF/MANIFEST.MF =================================|| + * |-- WEB-INF/beans.xml + * |-- + test classes + * + */ + @Deployment + public static EnterpriseArchive twoPasAsLib() { + + JavaArchive processArchive1Jar = ShrinkWrap.create(JavaArchive.class, "processes1.jar") + .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/process1.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/pa1.xml", "META-INF/processes.xml"); + + JavaArchive processArchive2Jar = ShrinkWrap.create(JavaArchive.class, "processes.jar") + .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/process2.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/pa2.xml", "META-INF/processes.xml"); + + JavaArchive foxPlatformClientJar = DeploymentHelper.getEjbClient(); + + WebArchive testJar = ShrinkWrap.create(WebArchive.class, "client-test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .setManifest(new ByteArrayAsset(("Class-Path: " + foxPlatformClientJar.getName()+"\n").getBytes())) + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TestFoxPlatformClientAsEjbModule_twoPasAsLib.class); + + return ShrinkWrap.create(EnterpriseArchive.class, "twoPasAsLib.ear") + .addAsLibrary(processArchive1Jar) + .addAsLibrary(processArchive2Jar) + .addAsModule(foxPlatformClientJar) + .addAsModule(testJar) + .addAsLibrary(DeploymentHelper.getEngineCdi()); + } + + @Test + public void testTwoPasAsLib() { + ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class); + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("process1") + .count(); + Assert.assertEquals(1, count); + + count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("process2") + .count(); + Assert.assertEquals(1, count); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestFoxPlatformClientAsLibInWebModule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestFoxPlatformClientAsLibInWebModule.java new file mode 100644 index 0000000000000000000000000000000000000000..7902832551bc903890c6aabfc47d304fc1ee7131 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestFoxPlatformClientAsLibInWebModule.java @@ -0,0 +1,82 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.ear; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * This test verifies that a process archive packaging the Camunda Platform client + * can be packaged inside an EAR application. + * + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestFoxPlatformClientAsLibInWebModule extends AbstractFoxPlatformIntegrationTest { + + /** + * Deployment layout + * + * test-application.ear + * |-- test.war + * |-- lib / + * |-- fox-platform-client.jar + * |-- WEB-INF/classes + * |-- META-INF/processes.xml + * |-- org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml + * + */ + @Deployment + public static EnterpriseArchive deployment() { + + // this creates the process archive as a WAR file + WebArchive processArchive = initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml") + .addClass(TestFoxPlatformClientAsLibInWebModule.class); + + // this packages the WAR file inside an EAR file + return ShrinkWrap.create(EnterpriseArchive.class, "test-application.ear") + .addAsModule(processArchive); + + } + + @Test + public void testDeployProcessArchive() { + ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class); + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchive") + .count(); + + Assert.assertEquals(1, count); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestPaAnnotatedEjb.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestPaAnnotatedEjb.java new file mode 100644 index 0000000000000000000000000000000000000000..1408106a18f39f04fe1d176c98c4c641f313d4e9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestPaAnnotatedEjb.java @@ -0,0 +1,78 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.ear; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.deployment.ear.beans.AnnotatedEjbPa; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Tassilo Weidner + */ +@RunWith(Arquillian.class) +public class TestPaAnnotatedEjb extends AbstractFoxPlatformIntegrationTest { + + /** + * + * test-application.ear + * |-- pa.jar + * |-- AbstractFoxPlatformIntegrationTest.class + * |-- TestPaAnnotatedEjb.class + * + * |-- AnnotatedEjbPa.class + * |-- process.bpmn + * |-- deployment-descriptor-with-custom-filename.xml + * |-- META-INF/beans.xml + * + * |-- camunda-engine-cdi.jar + * |-- META-INF/MANIFEST.MF + * + */ + @Deployment + public static EnterpriseArchive paAsEjbModule() { + + JavaArchive processArchive1Jar = ShrinkWrap.create(JavaArchive.class, "pa.jar") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TestPaAnnotatedEjb.class) + .addClass(AnnotatedEjbPa.class) + .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/process1.bpmn20.xml", "process.bpmn") + .addAsResource("META-INF/processes.xml", "deployment-descriptor-with-custom-filename.xml") + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); + + return ShrinkWrap.create(EnterpriseArchive.class, "paAsEjbModule.ear") + .addAsModule(processArchive1Jar) + .addAsLibrary(DeploymentHelper.getEngineCdi()); + } + + @Test + public void testPaAnnotatedEjb() { + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process1"); + + Assert.assertNotNull(processInstance); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestPaAsEjbJar.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestPaAsEjbJar.java new file mode 100644 index 0000000000000000000000000000000000000000..3a0a1fd1e6cbea318b9540946a673c93214bd071 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/TestPaAsEjbJar.java @@ -0,0 +1,87 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.ear; + +import org.camunda.bpm.application.impl.ejb.DefaultEjbProcessApplication; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.integrationtest.deployment.ear.beans.NamedCdiBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Roman Smirnov + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestPaAsEjbJar extends AbstractFoxPlatformIntegrationTest { + + /** + * + * test-application.ear + * |-- pa.jar + * |-- DefaultEjbProcessApplication.class + * |-- NamedCdiBean.class + * |-- AbstractFoxPlatformIntegrationTest.class + * |-- TestPaAsEjbJar.class + * |-- org/camunda/bpm/integrationtest/deployment/ear/paAsEjbJar-process.bpmn20.xml + * |-- META-INF/processes.xml + * |-- META-INF/beans.xml + * + * |-- camunda-engine-cdi.jar + * |-- META-INF/MANIFEST.MF + * + */ + @Deployment + public static EnterpriseArchive paAsEjbModule() throws Exception { + + JavaArchive processArchive1Jar = ShrinkWrap.create(JavaArchive.class, "pa.jar") + .addClass(DefaultEjbProcessApplication.class) + .addClass(NamedCdiBean.class) + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TestPaAsEjbJar.class) + .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/paAsEjbJar-process.bpmn20.xml") + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addAsManifestResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml"); + + return ShrinkWrap.create(EnterpriseArchive.class, "paAsEjbModule.ear") + .addAsModule(processArchive1Jar) + .addAsLibrary(DeploymentHelper.getEngineCdi()); + } + + @Test + public void testPaAsEjbModule() { + ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class); + Assert.assertNotNull(processEngine); + + runtimeService.startProcessInstanceByKey("paAsEjbJar-process"); + Assert.assertEquals(1, runtimeService.createProcessInstanceQuery().count()); + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(0, runtimeService.createProcessInstanceQuery().count()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/beans/AnnotatedEjbPa.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/beans/AnnotatedEjbPa.java new file mode 100644 index 0000000000000000000000000000000000000000..28caa906bc3024cbf4bb02e52d146b144bcdce44 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/beans/AnnotatedEjbPa.java @@ -0,0 +1,53 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.ear.beans; + +import org.camunda.bpm.application.ProcessApplication; +import org.camunda.bpm.application.ProcessApplicationInterface; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.ejb.ConcurrencyManagement; +import javax.ejb.ConcurrencyManagementType; +import javax.ejb.Local; +import javax.ejb.Singleton; +import javax.ejb.Startup; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; + +/** + * @author Tassilo Weidner + */ +@Singleton +@Startup +@ConcurrencyManagement(ConcurrencyManagementType.BEAN) +@TransactionAttribute(TransactionAttributeType.REQUIRED) +@ProcessApplication(deploymentDescriptors = {"deployment-descriptor-with-custom-filename.xml"}) +@Local(ProcessApplicationInterface.class) +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class AnnotatedEjbPa extends org.camunda.bpm.application.impl.EjbProcessApplication { + + @PostConstruct + public void start() { + deploy(); + } + + @PreDestroy + public void stop() { + undeploy(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/beans/EeComponent.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/beans/EeComponent.java new file mode 100644 index 0000000000000000000000000000000000000000..58b99a2550ff42511d9d02ae3a82e61654c9e606 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/beans/EeComponent.java @@ -0,0 +1,24 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.ear.beans; + +import javax.ejb.Stateless; + +@Stateless +public class EeComponent { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/beans/NamedCdiBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/beans/NamedCdiBean.java new file mode 100644 index 0000000000000000000000000000000000000000..1a2014618a9227bd3e05865d78bb210a112bc08a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/ear/beans/NamedCdiBean.java @@ -0,0 +1,34 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.ear.beans; + +import javax.inject.Named; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +/** + * @author Roman Smirnov + */ +@Named +public class NamedCdiBean implements JavaDelegate { + + public void execute(DelegateExecution execution) throws Exception { + execution.setVariable("a", "b"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/jar/TestJarDeployment.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/jar/TestJarDeployment.java new file mode 100644 index 0000000000000000000000000000000000000000..6a6544fdcf2e11e6772031b15d24a13d1d4bc9a0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/jar/TestJarDeployment.java @@ -0,0 +1,63 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.jar; + +import org.camunda.bpm.application.impl.ejb.DefaultEjbProcessApplication; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OverProtocol; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * This test only runs on WildFly, as for all other servers, Arquillian wraps the jar in a war file + * to pack the test runtime. However, we want to deploy a plain jar. This is supported by JBoss-exclusive + * protocol 'jmx-as7'. + * + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class TestJarDeployment extends AbstractFoxPlatformIntegrationTest { + + @Deployment + @OverProtocol("jmx-as7") + public static JavaArchive processArchive() { + return ShrinkWrap.create(JavaArchive.class) + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(DefaultEjbProcessApplication.class) + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml"); + } + + @Test + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchive") + .count(); + + Assert.assertEquals(1, count); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/CustomSpringServletProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/CustomSpringServletProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..767c3a129fb66159fe7391dc817f72580d0f004b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/CustomSpringServletProcessApplication.java @@ -0,0 +1,57 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.spring; + +import org.camunda.bpm.application.PostDeploy; +import org.camunda.bpm.application.PreUndeploy; +import org.camunda.bpm.engine.spring.application.SpringServletProcessApplication; +import org.junit.Assert; + +/** + * @author Daniel Meyer + * + */ +public class CustomSpringServletProcessApplication extends SpringServletProcessApplication { + + private boolean isPostDeployInvoked = false; + private boolean isPreUndeployInvoked = false; + + @PostDeploy + public void postDeploy() { + isPostDeployInvoked = true; + } + + @PreUndeploy + public void preUndeploy() { + isPreUndeployInvoked = true; + } + + @Override + public void start() { + Assert.assertFalse(isPostDeployInvoked); + super.start(); + Assert.assertTrue("@PostDeploy Method not invoked", isPostDeployInvoked); + } + + @Override + public void stop() { + Assert.assertFalse(isPreUndeployInvoked); + super.stop(); + Assert.assertTrue("@PreUndeploy Method not invoked", isPreUndeployInvoked); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/SpringLookupManagedProcessEngineTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/SpringLookupManagedProcessEngineTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ca161038544dbacc97b7ece4261efa20f24de8fb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/SpringLookupManagedProcessEngineTest.java @@ -0,0 +1,55 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.spring; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + *

Integration test making sure that we can lookup a managed process engine + * and expose it as a Spring Bean inside a Spring Application

+ * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class SpringLookupManagedProcessEngineTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return ShrinkWrap.create(WebArchive.class, "test.war") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsWebInfResource("org/camunda/bpm/integrationtest/deployment/spring/SpringLookupManagedProcessEngineTest-context.xml", "applicationContext.xml") + .addAsLibraries(DeploymentHelper.getEngineSpring()) + .addAsManifestResource("org/camunda/bpm/integrationtest/deployment/spring/jboss-deployment-structure.xml", "jboss-deployment-structure.xml") + .addAsWebInfResource("org/camunda/bpm/integrationtest/deployment/spring/web.xml", "web.xml"); + } + + + @Test + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/SpringServletPALifecycleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/SpringServletPALifecycleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d00716839f18e33a6771864d4c13f0d41c43f146 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/SpringServletPALifecycleTest.java @@ -0,0 +1,54 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.spring; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.ProcessApplicationService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class SpringServletPALifecycleTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return ShrinkWrap.create(WebArchive.class, "test.war") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(CustomSpringServletProcessApplication.class) + .addAsWebInfResource("org/camunda/bpm/integrationtest/deployment/spring/SpringServletPALifecycleTest-context.xml", "applicationContext.xml") + .addAsLibraries(DeploymentHelper.getEngineSpring()) + .addAsWebInfResource("org/camunda/bpm/integrationtest/deployment/spring/web.xml", "web.xml"); + } + + @Test + public void test() { + ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService(); + Assert.assertNotNull(processApplicationService.getProcessApplicationInfo("pa")); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/timer/ApplicationContext.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/timer/ApplicationContext.java new file mode 100644 index 0000000000000000000000000000000000000000..a4da523719c3f9ed0ea643ad0b1de401182694bb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/timer/ApplicationContext.java @@ -0,0 +1,74 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.spring.timer; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.ProcessEngineService; +import org.camunda.bpm.engine.HistoryService; +import org.camunda.bpm.engine.ManagementService; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.TaskService; +import org.camunda.bpm.engine.spring.application.SpringProcessApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class ApplicationContext { + + @Bean + public ProcessEngineService processEngineService() { + return BpmPlatform.getProcessEngineService(); + } + + @Bean(destroyMethod = "") + public ProcessEngine processEngine(){ + return BpmPlatform.getDefaultProcessEngine(); + } + + @Bean + public SpringProcessApplication processApplication() { + return new SpringProcessApplication(); + } + + @Bean + public RepositoryService repositoryService(ProcessEngine processEngine) { + return processEngine.getRepositoryService(); + } + + @Bean + public RuntimeService runtimeService(ProcessEngine processEngine) { + return processEngine.getRuntimeService(); + } + + @Bean + public TaskService taskService(ProcessEngine processEngine) { + return processEngine.getTaskService(); + } + + @Bean + public HistoryService historyService(ProcessEngine processEngine) { + return processEngine.getHistoryService(); + } + + @Bean + public ManagementService managementService(ProcessEngine processEngine) { + return processEngine.getManagementService(); + } + +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/timer/MyBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/timer/MyBean.java new file mode 100644 index 0000000000000000000000000000000000000000..8873b01ae8fc99efa64c211f6c5cdea3c84633c8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/timer/MyBean.java @@ -0,0 +1,28 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.spring.timer; + +import org.springframework.stereotype.Component; + +@Component +public class MyBean { + + public String getTimerDefinition() { + return "R2/PT1S"; + } + +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/timer/SpringServletPATimerStartEventExpressionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/timer/SpringServletPATimerStartEventExpressionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e850df12b4f7a8a5260021761795d9d573eedd0a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/spring/timer/SpringServletPATimerStartEventExpressionTest.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.spring.timer; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class SpringServletPATimerStartEventExpressionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return ShrinkWrap.create(WebArchive.class, "test.war") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(ApplicationContext.class) + .addClass(MyBean.class) + .addAsResource("META-INF/scan_for_definitions_processes.xml", "META-INF/processes.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/spring/timer/timer-start-event-process.bpmn", "timer-start-event-process.bpmn") + .addAsWebInfResource("org/camunda/bpm/integrationtest/deployment/spring/timer/start-event-expression-web.xml", "web.xml") + .addAsLibraries(DeploymentHelper.getEngineSpring()); + } + + @Test + public void shouldStartProcessInstance() { + runtimeService.startProcessInstanceByKey("timer-start-event-process"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestMultipleClasspathRoots.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestMultipleClasspathRoots.java new file mode 100644 index 0000000000000000000000000000000000000000..bdf4d290d9e2e20525f9bebaf04675f726e70995 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestMultipleClasspathRoots.java @@ -0,0 +1,115 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.bpm.integrationtest.util.TestHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Roman Smirnov + * + */ +@RunWith(Arquillian.class) +public class TestMultipleClasspathRoots extends AbstractFoxPlatformIntegrationTest { + + public final static String PROCESSES_XML = + "" + + + "" + + "" + + "true" + + "classpath:directory" + + "" + + "" + + + ""; + + /** + *
+   *   |-- test.war
+   *       |-- WEB-INF
+   *           |-- classes
+   *               |-- META-INF/processes.xml                   resourceRootPath: classpath:directory
+   *               |-- directory/processes/process.bpmn         (1)
+   *           |-- lib/
+   *               |-- pa0.jar
+   *                   |-- directory/processes/process.bpmn     (2)
+   * 
+ * + * Processes (1) + (2) will have the same resource name (= "processes/process.bpmn"), + * so that only one process should be deployed. + * + */ + @Deployment + public static WebArchive processArchive() { + + Asset paProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML, + new String[][]{new String[]{"PA_NAME","PA0"}}); + + + Asset[] processAssets = TestHelper.generateProcessAssets(2); + + JavaArchive pa0 = ShrinkWrap.create(JavaArchive.class, "pa0.jar") + .addAsResource(processAssets[0], "directory/processes/process.bpmn"); + + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + + .addAsLibraries(pa0) + + .addAsResource(paProcessesXml, "META-INF/processes.xml") + .addAsResource(processAssets[1], "directory/processes/process.bpmn") + + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TestResourceName.class); + + TestContainer.addContainerSpecificResources(archive); + + return archive; + } + + @Test + public void testMultipleClasspathRoots() { + ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class); + Assert.assertNotNull(processEngine); + + RepositoryService repositoryService = processEngine.getRepositoryService(); + + ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery(); + + long count = query.count(); + Assert.assertEquals(1, count); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestResourceName.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestResourceName.java new file mode 100644 index 0000000000000000000000000000000000000000..acba180693e23724192f12a1ada867c640b5c76f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestResourceName.java @@ -0,0 +1,178 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.engine.repository.ProcessDefinitionQuery; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.bpm.integrationtest.util.TestHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Roman Smirnov + * + */ +@RunWith(Arquillian.class) +public class TestResourceName extends AbstractFoxPlatformIntegrationTest { + + public final static String PROCESSES_XML = + "" + + + "" + + "" + + "true" + + "" + + "" + + + ""; + + public final static String PROCESSES_XML_WITH_RESOURCE_ROOT_PATH = + "" + + + "" + + "" + + "true" + + "RESOURCE_ROOT_PATH" + + "" + + "" + + + ""; + + + /** + *
+   *   |-- test.war
+   *       |-- WEB-INF
+   *           |-- classes
+   *               |-- alternateDirectory/process4.bpmn
+   *               |-- alternateDirectory/subDirectory/process5.bpmn
+   *           |-- lib/
+   *               |-- pa0.jar
+   *                   |-- META-INF/processes.xml
+   *                   |-- process0.bpmn
+   *               |-- pa1.jar
+   *                   |-- META-INF/processes.xml
+   *                   |-- processes/process1.bpmn
+   *               |-- pa2.jar
+   *                   |-- META-INF/processes.xml                resourceRootPath: pa:directory
+   *                   |-- directory/process2.bpmn
+   *                   |-- directory/subDirectory/process3.bpmn
+   *               |-- pa3.jar
+   *                   |-- META-INF/processes.xml                resourceRootPath: classpath:alternateDirectory
+   * 
+ */ + @Deployment + public static WebArchive processArchive() { + + Asset pa1ProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML, + new String[][]{new String[]{"PA_NAME","PA0"}}); + + Asset pa2ProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML, + new String[][]{new String[]{"PA_NAME","PA1"}}); + + Asset pa3ProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML_WITH_RESOURCE_ROOT_PATH, + new String[][]{new String[]{"PA_NAME","PA2"}, new String[]{"RESOURCE_ROOT_PATH", "pa:directory"}}); + + Asset pa4ProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML_WITH_RESOURCE_ROOT_PATH, + new String[][]{new String[]{"PA_NAME","PA3"}, new String[]{"RESOURCE_ROOT_PATH", "classpath:alternateDirectory"}}); + + Asset[] processAssets = TestHelper.generateProcessAssets(6); + + JavaArchive pa1 = ShrinkWrap.create(JavaArchive.class, "pa0.jar") + .addAsResource(pa1ProcessesXml, "META-INF/processes.xml") + .addAsResource(processAssets[0], "process0.bpmn"); + + JavaArchive pa2 = ShrinkWrap.create(JavaArchive.class, "pa1.jar") + .addAsResource(pa2ProcessesXml, "META-INF/processes.xml") + .addAsResource(processAssets[1], "processes/process1.bpmn"); + + JavaArchive pa3 = ShrinkWrap.create(JavaArchive.class, "pa2.jar") + .addAsResource(pa3ProcessesXml, "META-INF/processes.xml") + .addAsResource(processAssets[2], "directory/process2.bpmn") + .addAsResource(processAssets[3], "directory/subDirectory/process3.bpmn"); + + JavaArchive pa4 = ShrinkWrap.create(JavaArchive.class, "pa3.jar") + .addAsResource(pa4ProcessesXml, "META-INF/processes.xml"); + + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + + .addAsLibraries(pa1) + .addAsLibraries(pa2) + .addAsLibraries(pa3) + .addAsLibraries(pa4) + + + .addAsResource(processAssets[4], "alternateDirectory/process4.bpmn") + .addAsResource(processAssets[5], "alternateDirectory/subDirectory/process5.bpmn") + + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TestContainer.class) + .addClass(TestResourceName.class); + + TestContainer.addContainerSpecificResources(archive); + + return archive; + } + + @Test + public void testResourceName() { + ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class); + Assert.assertNotNull(processEngine); + + RepositoryService repositoryService = processEngine.getRepositoryService(); + + ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery(); + + ProcessDefinition definition = query.processDefinitionKey("process-0").singleResult(); + Assert.assertEquals("process0.bpmn", definition.getResourceName()); + + definition = query.processDefinitionKey("process-1").singleResult(); + Assert.assertEquals("processes/process1.bpmn", definition.getResourceName()); + + definition = query.processDefinitionKey("process-2").singleResult(); + Assert.assertEquals("process2.bpmn", definition.getResourceName()); + + definition = query.processDefinitionKey("process-3").singleResult(); + Assert.assertEquals("subDirectory/process3.bpmn", definition.getResourceName()); + + definition = query.processDefinitionKey("process-4").singleResult(); + Assert.assertEquals("process4.bpmn", definition.getResourceName()); + + definition = query.processDefinitionKey("process-5").singleResult(); + Assert.assertEquals("subDirectory/process5.bpmn", definition.getResourceName()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeployment.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeployment.java new file mode 100644 index 0000000000000000000000000000000000000000..9331c10870e4f4f5a33db34a8cd89d60ef1aedff --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeployment.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + + +@RunWith(Arquillian.class) +public class TestWarDeployment extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml"); + } + + @Test + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchive") + .count(); + + Assert.assertEquals(1, count); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentCustomPAName.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentCustomPAName.java new file mode 100644 index 0000000000000000000000000000000000000000..06914a054e7dd9c583da48ca40a12f673c5ef983 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentCustomPAName.java @@ -0,0 +1,56 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.integrationtest.deployment.war.apps.CustomNameServletPA; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.Set; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentCustomPAName extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return ShrinkWrap.create(WebArchive.class, "pa1.war") + .addAsResource("META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(CustomNameServletPA.class) + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml"); + } + + @Test + public void testProcessApplicationName() { + Set paNames = BpmPlatform.getProcessApplicationService().getProcessApplicationNames(); + + Assert.assertEquals(1, paNames.size()); + Assert.assertTrue(paNames.contains(CustomNameServletPA.NAME)); + + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentDeployAllOnSingleChange.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentDeployAllOnSingleChange.java new file mode 100644 index 0000000000000000000000000000000000000000..b3fd1d6c98b3f44c993365db001afa292766b74b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentDeployAllOnSingleChange.java @@ -0,0 +1,71 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + + +@RunWith(Arquillian.class) +public class TestWarDeploymentDeployAllOnSingleChange extends AbstractFoxPlatformIntegrationTest { + + private static final String PA1 = "PA1"; + private static final String PA2 = "PA2"; + + @Deployment(order=1, name=PA1) + public static WebArchive processArchive1() { + return initWebArchiveDeployment("pa1.war") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveV1.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveUnchanged.bpmn20.xml"); + } + + @Deployment(order=2, name=PA2) + public static WebArchive processArchive2() { + return initWebArchiveDeployment("pa2.war", "org/camunda/bpm/integrationtest/deployment/war/deployAllOnSingleChange_processes.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveV2.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveUnchanged.bpmn20.xml"); + + } + + @Test + @OperateOnDeployment(value=PA2) + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchive") + .count(); + + Assert.assertEquals(2, count); + + count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchiveUnchanged") + .count(); + + Assert.assertEquals(2, count); + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentDeployChangedOnly.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentDeployChangedOnly.java new file mode 100644 index 0000000000000000000000000000000000000000..4724a44d24ed97d290022e7076e5a2d280cbac0d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentDeployChangedOnly.java @@ -0,0 +1,71 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + + +@RunWith(Arquillian.class) +public class TestWarDeploymentDeployChangedOnly extends AbstractFoxPlatformIntegrationTest { + + private static final String PA1 = "PA1"; + private static final String PA2 = "PA2"; + + @Deployment(order=1, name=PA1) + public static WebArchive processArchive1() { + return initWebArchiveDeployment("pa1.war") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveV1.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveUnchanged.bpmn20.xml"); + } + + @Deployment(order=2, name=PA2) + public static WebArchive processArchive2() { + return initWebArchiveDeployment("pa2.war", "org/camunda/bpm/integrationtest/deployment/war/deployChangedOnly_processes.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveV2.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveUnchanged.bpmn20.xml"); + + } + + @Test + @OperateOnDeployment(value=PA2) + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchive") + .count(); + + Assert.assertEquals(2, count); + + count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchiveUnchanged") + .count(); + + Assert.assertEquals(1, count); + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentDeployChangedOnlyWithJarAsLib.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentDeployChangedOnlyWithJarAsLib.java new file mode 100644 index 0000000000000000000000000000000000000000..15d56b05514e8c3f7d46f3070357416ade0fac44 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentDeployChangedOnlyWithJarAsLib.java @@ -0,0 +1,123 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * + * @author Roman Smirnov + * + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentDeployChangedOnlyWithJarAsLib extends AbstractFoxPlatformIntegrationTest { + + private static final String PA1 = "PA1"; + private static final String PA2 = "PA2"; + + /** + *
+   *   |-- pa1.war
+   *       |-- WEB-INF
+   *           |-- lib/
+   *               |-- test-v1.jar
+   *                   |-- META-INF/processes.xml
+   *                   |-- process.bpmn
+   * 
+ */ + @Deployment(order=1, name=PA1) + public static WebArchive archive1() { + + JavaArchive processArchiveJar = ShrinkWrap.create(JavaArchive.class, "test-v1.jar") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveUnchanged.bpmn20.xml", "process.bpmn") + .addAsResource("META-INF/processes.xml"); + + WebArchive archive = ShrinkWrap.create(WebArchive.class, "pa1.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + + .addAsLibraries(processArchiveJar) + + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TestWarDeploymentDeployChangedOnlyWithJarAsLib.class); + + TestContainer.addContainerSpecificResources(archive); + + return archive; + } + + /** + *
+   *   |-- pa2.war
+   *       |-- WEB-INF
+   *           |-- lib/
+   *               |-- test-v2.jar
+   *                   |-- META-INF/processes.xml
+   *                   |-- process.bpmn
+   * 
+ */ + @Deployment(order=2, name=PA2) + public static WebArchive archive2() { + + JavaArchive processArchiveJar = ShrinkWrap.create(JavaArchive.class, "test-v2.jar") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveUnchanged.bpmn20.xml", "process.bpmn") + .addAsResource("META-INF/processes.xml"); + + WebArchive archive = ShrinkWrap.create(WebArchive.class, "pa2.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + + .addAsLibraries(processArchiveJar) + + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TestWarDeploymentDeployChangedOnlyWithJarAsLib.class); + + TestContainer.addContainerSpecificResources(archive); + + return archive; + } + + @Test + @OperateOnDeployment(value=PA2) + public void testDeployProcessArchive() { + ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class); + Assert.assertNotNull(processEngine); + + RepositoryService repositoryService = processEngine.getRepositoryService(); + + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchiveUnchanged") + .count(); + + Assert.assertEquals(1, count); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentDuplicateFiltering.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentDuplicateFiltering.java new file mode 100644 index 0000000000000000000000000000000000000000..6fcd14e493437ccd0e7fd9eba84b3f035ead736b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentDuplicateFiltering.java @@ -0,0 +1,61 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + + +@RunWith(Arquillian.class) +public class TestWarDeploymentDuplicateFiltering extends AbstractFoxPlatformIntegrationTest { + + private static final String PA1 = "PA1"; + private static final String PA2 = "PA2"; + + @Deployment(order=1, name=PA1) + public static WebArchive processArchive1() { + return initWebArchiveDeployment("pa2.war") + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml"); + } + + @Deployment(order=2, name=PA2) + public static WebArchive processArchive2() { + return initWebArchiveDeployment("pa1.war") + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml"); + + } + + @Test + @OperateOnDeployment(value=PA2) + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchive") + .count(); + + Assert.assertEquals(1, count); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentEmptyProcessesXml.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentEmptyProcessesXml.java new file mode 100644 index 0000000000000000000000000000000000000000..b773ec942f8d92d9c6ea802f0a40c0588ec28720 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentEmptyProcessesXml.java @@ -0,0 +1,80 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.List; +import java.util.Set; + +import static org.junit.Assert.assertTrue; + + +/** + * Assert that we can deploy a WAR which bundles + * the client and an empty processes.xml file + * + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentEmptyProcessesXml extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment("test.war", "META-INF/empty_processes.xml") + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml"); + } + + @Test + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + + List processDefinitions = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchive") + .list(); + + Assert.assertEquals(1, processDefinitions.size()); + org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery() + .deploymentId(processDefinitions.get(0).getDeploymentId()) + .singleResult(); + + Set registeredProcessApplications = BpmPlatform.getProcessApplicationService().getProcessApplicationNames(); + + boolean containsProcessApplication = false; + + // the process application name is used as name for the db deployment + for (String appName : registeredProcessApplications) { + if (appName.equals(deployment.getName())) { + containsProcessApplication = true; + } + } + assertTrue(containsProcessApplication); + + + // manually delete process definition here (to clean up) + repositoryService.deleteDeployment(deployment.getId(), true); + } + +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentIsDeployChangedOnly.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentIsDeployChangedOnly.java new file mode 100644 index 0000000000000000000000000000000000000000..3388f13f6d950fe6998c889978361a0d7c7995de --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentIsDeployChangedOnly.java @@ -0,0 +1,85 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; +import java.util.List; +import java.util.Set; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.ProcessApplicationService; +import org.camunda.bpm.application.ProcessApplicationDeploymentInfo; +import org.camunda.bpm.application.ProcessApplicationInfo; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class TestWarDeploymentIsDeployChangedOnly extends AbstractFoxPlatformIntegrationTest { + + private static final String PA1 = "PA1"; + private static final String PA2 = "PA2"; + + @Deployment(order=1, name=PA1) + public static WebArchive processArchive1() { + return initWebArchiveDeployment("pa1.war") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveV1.bpmn20.xml"); + } + + @Deployment(order=2, name=PA2) + public static WebArchive processArchive2() { + return initWebArchiveDeployment("pa2.war", "org/camunda/bpm/integrationtest/deployment/war/isDeployChangedOnly_processes.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveV1.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testProcess.bpmn20.xml"); + + } + + @Test + @OperateOnDeployment(value=PA2) + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchive") + .count(); + + Assert.assertEquals(1, count); + + // validate registrations: + ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService(); + Set processApplicationNames = processApplicationService.getProcessApplicationNames(); + boolean resumedRegistrationFound = false; + for (String paName : processApplicationNames) { + ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName); + List deploymentInfo = processApplicationInfo.getDeploymentInfo(); + if(deploymentInfo.size() == 2) { + if(resumedRegistrationFound) { + Assert.fail("Cannot have two registrations"); + } + resumedRegistrationFound = true; + } + } + Assert.assertTrue("Previous version of the deployment was not resumed", resumedRegistrationFound); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentResumePrevious.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentResumePrevious.java new file mode 100644 index 0000000000000000000000000000000000000000..86f2a760e0e0671963d63d6e0173be057ebecd7f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentResumePrevious.java @@ -0,0 +1,85 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; +import java.util.List; +import java.util.Set; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.ProcessApplicationService; +import org.camunda.bpm.application.ProcessApplicationDeploymentInfo; +import org.camunda.bpm.application.ProcessApplicationInfo; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + + +@RunWith(Arquillian.class) +public class TestWarDeploymentResumePrevious extends AbstractFoxPlatformIntegrationTest { + + private static final String PA1 = "PA1"; + private static final String PA2 = "PA2"; + + @Deployment(order=1, name=PA1) + public static WebArchive processArchive1() { + return initWebArchiveDeployment("pa1.war") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveV1.bpmn20.xml"); + } + + @Deployment(order=2, name=PA2) + public static WebArchive processArchive2() { + return initWebArchiveDeployment("pa2.war") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveV2.bpmn20.xml"); + + } + + @Test + @OperateOnDeployment(value=PA2) + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchive") + .count(); + + Assert.assertEquals(2, count); + + // validate registrations: + ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService(); + Set processApplicationNames = processApplicationService.getProcessApplicationNames(); + boolean resumedRegistrationFound = false; + for (String paName : processApplicationNames) { + ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName); + List deploymentInfo = processApplicationInfo.getDeploymentInfo(); + if(deploymentInfo.size() == 2) { + if(resumedRegistrationFound) { + Assert.fail("Cannot have two registrations"); + } + resumedRegistrationFound = true; + } + } + Assert.assertTrue("Previous version of the deployment was not resumed", resumedRegistrationFound); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentResumePreviousOff.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentResumePreviousOff.java new file mode 100644 index 0000000000000000000000000000000000000000..41700840f97ed9f30b315389572342b71d74f5ff --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentResumePreviousOff.java @@ -0,0 +1,80 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; +import java.util.List; +import java.util.Set; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.ProcessApplicationService; +import org.camunda.bpm.application.ProcessApplicationDeploymentInfo; +import org.camunda.bpm.application.ProcessApplicationInfo; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + + +@RunWith(Arquillian.class) +public class TestWarDeploymentResumePreviousOff extends AbstractFoxPlatformIntegrationTest { + + private static final String PA1 = "PA1"; + private static final String PA2 = "PA2"; + + @Deployment(order=1, name=PA1) + public static WebArchive processArchive1() { + return initWebArchiveDeployment("pa1.war") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveV1.bpmn20.xml"); + } + + @Deployment(order=2, name=PA2) + public static WebArchive processArchive2() { + return initWebArchiveDeployment("pa2.war", "org/camunda/bpm/integrationtest/deployment/war/resumePreviousVersionsOff_processes.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveV2.bpmn20.xml"); + + } + + @Test + @OperateOnDeployment(value=PA2) + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchive") + .count(); + + Assert.assertEquals(2, count); + + // validate registrations: + ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService(); + Set processApplicationNames = processApplicationService.getProcessApplicationNames(); + for (String paName : processApplicationNames) { + ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName); + List deploymentInfo = processApplicationInfo.getDeploymentInfo(); + if(deploymentInfo.size() == 2) { + Assert.fail("Previous version of the deployment must not be resumed"); + } + } + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentResumePreviousOnDeploymentName.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentResumePreviousOnDeploymentName.java new file mode 100644 index 0000000000000000000000000000000000000000..ae69f022073c35169bf2c2564c830e0a883e4461 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentResumePreviousOnDeploymentName.java @@ -0,0 +1,90 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + +import java.util.List; +import java.util.Set; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.ProcessApplicationService; +import org.camunda.bpm.application.ProcessApplicationDeploymentInfo; +import org.camunda.bpm.application.ProcessApplicationInfo; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class TestWarDeploymentResumePreviousOnDeploymentName extends AbstractFoxPlatformIntegrationTest { + + private static final String PA1 = "PA1"; + private static final String PA2 = "PA2"; + + @Deployment(order = 1, name = PA1) + public static WebArchive processArchive1() { + return initWebArchiveDeployment("pa1.war").addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveV1.bpmn20.xml"); + } + + @Deployment(order = 2, name = PA2) + public static WebArchive processArchive2() { + return initWebArchiveDeployment("pa2.war", "org/camunda/bpm/integrationtest/deployment/war/resumePreviousVersionsOnDeploymentName_processes.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testProcess.bpmn20.xml"); + + } + + @Test + @OperateOnDeployment(value = PA2) + public void testDeployProcessArchive() { + assertThat(processEngine, is(notNullValue())); + RepositoryService repositoryService = processEngine.getRepositoryService(); + //since we have two processes deployed for PA2 we gotta check that both are present + long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testDeployProcessArchive").count(); + + assertThat(count, is(1L)); + + count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testProcess").count(); + + assertThat(count, is(1L)); + + // validate registrations: + ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService(); + Set processApplicationNames = processApplicationService.getProcessApplicationNames(); + // we have two PAs, one from the first deployment and one from the second + // and only one (the second) is allowed to have two deployments + boolean resumedRegistrationFound = false; + for (String paName : processApplicationNames) { + ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName); + List deploymentInfo = processApplicationInfo.getDeploymentInfo(); + if (deploymentInfo.size() == 2) { + if (resumedRegistrationFound) { + fail("Cannot have two registrations"); + } + resumedRegistrationFound = true; + } + } + assertThat("Previous version of the deployment was not resumed", resumedRegistrationFound, is(true)); + } +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentResumePreviousOnProcessDefinitionKey.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentResumePreviousOnProcessDefinitionKey.java new file mode 100644 index 0000000000000000000000000000000000000000..8a36a9e96e029b1f9fb5f3c84720fbe03c17d340 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentResumePreviousOnProcessDefinitionKey.java @@ -0,0 +1,87 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + +import java.util.List; +import java.util.Set; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.ProcessApplicationService; +import org.camunda.bpm.application.ProcessApplicationDeploymentInfo; +import org.camunda.bpm.application.ProcessApplicationInfo; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class TestWarDeploymentResumePreviousOnProcessDefinitionKey extends AbstractFoxPlatformIntegrationTest { + + private static final String PA1 = "PA1"; + private static final String PA2 = "PA2"; + + @Deployment(order=1, name=PA1) + public static WebArchive processArchive1() { + return initWebArchiveDeployment("pa1.war") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveV1.bpmn20.xml"); + } + + @Deployment(order=2, name=PA2) + public static WebArchive processArchive2() { + return initWebArchiveDeployment("pa2.war", "org/camunda/bpm/integrationtest/deployment/war/resumePreviousVersionsOnProcessDefinitionKey_processes.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/testDeployProcessArchiveV2.bpmn20.xml"); + + } + + @Test + @OperateOnDeployment(value=PA2) + public void testDeployProcessArchive() { + assertThat(processEngine, is(notNullValue())); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey("testDeployProcessArchive") + .count(); + + assertThat(count, is(2L)); + + // validate registrations: + ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService(); + Set processApplicationNames = processApplicationService.getProcessApplicationNames(); + // we have two PAs, one from the first deployment and one from the second and only one (the second) is allowed to have two deployments + boolean resumedRegistrationFound = false; + for (String paName : processApplicationNames) { + ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName); + List deploymentInfo = processApplicationInfo.getDeploymentInfo(); + if(deploymentInfo.size() == 2) { + if(resumedRegistrationFound) { + fail("Cannot have two registrations"); + } + resumedRegistrationFound = true; + } + } + assertThat("Previous version of the deployment was not resumed", resumedRegistrationFound, is(true)); + } +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithBrokenBpmnXml.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithBrokenBpmnXml.java new file mode 100644 index 0000000000000000000000000000000000000000..327175f660c2da4669a21c6852ae823aad979827 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithBrokenBpmnXml.java @@ -0,0 +1,69 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * In this test we make sure that if a user deploys a WAR file with a broken + * .bpmn-XML file, the deployment fails. + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentWithBrokenBpmnXml { + + private static final String DEPLOYMENT = "deployment"; + + @ArquillianResource + private Deployer deployer; + + @Deployment(managed=false, name=DEPLOYMENT) + public static WebArchive processArchive() { + + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithBrokenBpmnXml.testXmlInvalid.bpmn20.xml"); + + TestContainer.addContainerSpecificResources(deployment); + + return deployment; + } + + @Test + public void testXmlInvalid() { + try { + deployer.deploy(DEPLOYMENT); + Assert.fail("exception expected"); + }catch (Exception e) { + // expected + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithCmmn.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithCmmn.java new file mode 100644 index 0000000000000000000000000000000000000000..cc99a020ec8db5aad68e83e69493c32ef6f4636f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithCmmn.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + + +@RunWith(Arquillian.class) +public class TestWarDeploymentWithCmmn extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchiveWithCmmn.cmmn"); + } + + @Test + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createCaseDefinitionQuery() + .caseDefinitionKey("testDeployProcessArchiveWithCmmn") + .count(); + + Assert.assertEquals(1, count); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithDiagram.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithDiagram.java new file mode 100644 index 0000000000000000000000000000000000000000..220b17a92a5330c63ea2102b8a06fcd14b925963 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithDiagram.java @@ -0,0 +1,60 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.IOException; + + +/** + * @author Falko Menge + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentWithDiagram extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(TestHelper.class) + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.png") + .addAsResource("org/camunda/bpm/integrationtest/invoice-it.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/invoice-it.jpg"); + } + + @Test + public void testDeployProcessArchive() throws IOException { + String expectedDiagramResource = "/org/camunda/bpm/integrationtest/testDeployProcessArchive.png"; + String processDefinitionKey = "testDeployProcessArchive"; + TestHelper.assertDiagramIsDeployed(true, getClass(), expectedDiagramResource, processDefinitionKey); + } + + @Test + public void testInvoiceProcess() throws IOException { + String expectedDiagramResource = "/org/camunda/bpm/integrationtest/invoice-it.jpg"; + String processDefinitionKey = "invoice-it"; + TestHelper.assertDiagramIsDeployed(true, getClass(), expectedDiagramResource, processDefinitionKey); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithDmn.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithDmn.java new file mode 100644 index 0000000000000000000000000000000000000000..c76cf8d80667896381b60e5ddf731ab7751c51b8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithDmn.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class TestWarDeploymentWithDmn extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchiveWithDmn.dmn"); + } + + @Test + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + long count = repositoryService.createDecisionDefinitionQuery() + .decisionDefinitionKey("testDeployProcessArchiveWithDmn") + .count(); + + Assert.assertEquals(1, count); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment1.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment1.java new file mode 100644 index 0000000000000000000000000000000000000000..695d41196aa93bf2280814df71348bb1e4e7c3fb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment1.java @@ -0,0 +1,164 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.junit.Assert; + +import org.camunda.bpm.engine.repository.DeploymentQuery; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.bpm.integrationtest.util.TestHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + *

This test verifies that a WAR deployment can posess mutiple subdeployments + * that define process archives

+ * + *
+ *   |-- My-Application.war
+ *       |-- WEB-INF
+ *           |-- classes
+ *               |-- MEATA-INF/processes.xml               (1)
+ *                   |-- process0.bpmn    
+ *                   |-- directory/process1.bpmn
+ *                   |-- alternateDirectory/process2.bpmn 
+ *           |-- lib/
+ *               |-- pa2.jar 
+ *                   |-- META-INF/processes.xml            (2)
+ *                   |-- process3.bpmn    
+ *                   |-- directory/process4.bpmn
+ *                   |-- alternateDirectory/process5.bpmn
+ *                    
+ *               |-- pa3.jar
+ *                   |-- META-INF/processes.xml            (3)  
+ *                   |-- process6.bpmn    
+ *                   |-- directory/process7.bpmn
+ *                   |-- alternateDirectory/process8.bpmn
+ * 
+ * + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentWithMultiplePasAsSubdeployment1 extends AbstractFoxPlatformIntegrationTest { + + public final static String PROCESSES_XML = + "" + + + "" + + "" + + "true" + + "" + + "" + + + ""; + + + @Deployment + public static WebArchive processArchive() { + + Asset pa1ProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML, + new String[][]{new String[]{"PA_NAME","PA1"}}); + + Asset pa2ProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML, + new String[][]{new String[]{"PA_NAME","PA2"}}); + + Asset pa3ProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML, + new String[][]{new String[]{"PA_NAME","PA3"}}); + + Asset[] processAssets = TestHelper.generateProcessAssets(9); + + JavaArchive pa2 = ShrinkWrap.create(JavaArchive.class, "pa2.jar") + .addAsResource(pa2ProcessesXml, "META-INF/processes.xml") + .addAsResource(processAssets[3], "process3.bpmn") + .addAsResource(processAssets[4], "directory/process4.bpmn") + .addAsResource(processAssets[5], "alternateDirectory/process5.bpmn"); + + JavaArchive pa3 = ShrinkWrap.create(JavaArchive.class, "pa3.jar") + .addAsResource(pa3ProcessesXml, "META-INF/processes.xml") + .addAsResource(processAssets[6], "process6.bpmn") + .addAsResource(processAssets[7], "directory/process7.bpmn") + .addAsResource(processAssets[8], "alternateDirectory/process8.bpmn"); + + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + + .addAsLibraries(pa2) + .addAsLibraries(pa3) + + .addAsResource(pa1ProcessesXml, "META-INF/processes.xml") + .addAsResource(processAssets[0], "process0.bpmn") + .addAsResource(processAssets[1], "directory/process1.bpmn") + .addAsResource(processAssets[2], "alternateDirectory/process2.bpmn") + + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(deployment); + + return deployment; + + } + + @Test + public void testDeployProcessArchive() { + + assertProcessDeployed("process-0", "PA1"); + assertProcessDeployed("process-1", "PA1"); + assertProcessDeployed("process-2", "PA1"); + + assertProcessDeployed("process-3", "PA2"); + assertProcessDeployed("process-4", "PA2"); + assertProcessDeployed("process-5", "PA2"); + + assertProcessDeployed("process-6", "PA3"); + assertProcessDeployed("process-7", "PA3"); + assertProcessDeployed("process-8", "PA3"); + + } + + protected void assertProcessDeployed(String processKey, String expectedDeploymentName) { + + ProcessDefinition processDefinition = repositoryService + .createProcessDefinitionQuery() + .latestVersion() + .processDefinitionKey(processKey) + .singleResult(); + + DeploymentQuery deploymentQuery = repositoryService + .createDeploymentQuery() + .deploymentId(processDefinition.getDeploymentId()); + + Assert.assertEquals(expectedDeploymentName, deploymentQuery.singleResult().getName()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment2.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment2.java new file mode 100644 index 0000000000000000000000000000000000000000..01ce8aa0c36a70ceae4cc63a7fbd7381032a9bfd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment2.java @@ -0,0 +1,171 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.junit.Assert; + +import org.camunda.bpm.engine.repository.DeploymentQuery; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.bpm.integrationtest.util.TestHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + *

This test verifies that a WAR deployment can posess mutiple subdeployments + * that define process archives

+ * + *
+ *   |-- My-Application.war
+ *       |-- WEB-INF
+ *           |-- classes
+ *               |-- MEATA-INF/processes.xml               (1) resourceRootPath: pa:directory/
+ *                   |-- process0.bpmn    
+ *                   |-- directory/process1.bpmn
+ *                   |-- alternateDirectory/process2.bpmn 
+ *           |-- lib/
+ *               |-- pa2.jar 
+ *                   |-- META-INF/processes.xml            (2) resourceRootPath: pa:directory/
+ *                   |-- process3.bpmn    
+ *                   |-- directory/process4.bpmn
+ *                   |-- alternateDirectory/process5.bpmn
+ *                    
+ *               |-- pa3.jar
+ *                   |-- META-INF/processes.xml            (3) resourceRootPath: pa:directory/
+ *                   |-- process6.bpmn    
+ *                   |-- directory/process7.bpmn
+ *                   |-- alternateDirectory/process8.bpmn
+ * 
+ * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentWithMultiplePasAsSubdeployment2 extends AbstractFoxPlatformIntegrationTest { + + public final static String PROCESSES_XML = + "" + + + "" + + "" + + "true" + + "pa:directory/" + + "" + + "" + + + ""; + + @Deployment + public static WebArchive processArchive() { + + Asset pa1ProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML, + new String[][]{new String[]{"PA_NAME","PA1"}}); + + Asset pa2ProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML, + new String[][]{new String[]{"PA_NAME","PA2"}}); + + Asset pa3ProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML, + new String[][]{new String[]{"PA_NAME","PA3"}}); + + Asset[] processAssets = TestHelper.generateProcessAssets(9); + + JavaArchive pa2 = ShrinkWrap.create(JavaArchive.class, "pa2.jar") + .addAsResource(pa2ProcessesXml, "META-INF/processes.xml") + .addAsResource(processAssets[3], "process3.bpmn") + .addAsResource(processAssets[4], "directory/process4.bpmn") + .addAsResource(processAssets[5], "alternateDirectory/process5.bpmn"); + + JavaArchive pa3 = ShrinkWrap.create(JavaArchive.class, "pa3.jar") + .addAsResource(pa3ProcessesXml, "META-INF/processes.xml") + .addAsResource(processAssets[6], "process6.bpmn") + .addAsResource(processAssets[7], "directory/process7.bpmn") + .addAsResource(processAssets[8], "alternateDirectory/process8.bpmn"); + + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + + .addAsLibraries(pa2) + .addAsLibraries(pa3) + + .addAsResource(pa1ProcessesXml, "META-INF/processes.xml") + .addAsResource(processAssets[0], "process0.bpmn") + .addAsResource(processAssets[1], "directory/process1.bpmn") + .addAsResource(processAssets[2], "alternateDirectory/process2.bpmn") + + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(deployment); + + return deployment; + } + + @Test + public void testDeployProcessArchive() { + + assertProcessNotDeployed("process-0"); + assertProcessDeployed ("process-1", "PA1"); + assertProcessNotDeployed("process-2"); + assertProcessNotDeployed("process-3"); + assertProcessDeployed ("process-4", "PA2"); + assertProcessNotDeployed("process-5"); + assertProcessNotDeployed("process-6"); + assertProcessDeployed ("process-7", "PA3"); + assertProcessNotDeployed("process-8"); + + } + + protected void assertProcessNotDeployed(String processKey) { + + long count = repositoryService + .createProcessDefinitionQuery() + .latestVersion() + .processDefinitionKey(processKey) + .count(); + + Assert.assertEquals("Process with key "+processKey+ " should not be deployed", 0, count); + } + + protected void assertProcessDeployed(String processKey, String expectedDeploymentName) { + + ProcessDefinition processDefinition = repositoryService + .createProcessDefinitionQuery() + .latestVersion() + .processDefinitionKey(processKey) + .singleResult(); + + DeploymentQuery deploymentQuery = repositoryService + .createDeploymentQuery() + .deploymentId(processDefinition.getDeploymentId()); + + Assert.assertEquals(expectedDeploymentName, deploymentQuery.singleResult().getName()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment3.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment3.java new file mode 100644 index 0000000000000000000000000000000000000000..29e79399d6b54935be5b5648d4c48c4ec496cd7b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment3.java @@ -0,0 +1,137 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.junit.Assert; + +import org.camunda.bpm.engine.repository.DeploymentQuery; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.bpm.integrationtest.util.TestHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * + *
+ *   |-- My-Application.war
+ *       |-- WEB-INF
+ *           |-- classes
+ *                   |-- process0.bpmn    
+ *                   |-- directory/process1.bpmn
+ *                   |-- alternateDirectory/process2.bpmn 
+ *           |-- lib/
+ *               |-- pa2.jar 
+ *                   |-- META-INF/processes.xml uses classpath:directory/
+ * 
+ * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentWithMultiplePasAsSubdeployment3 extends AbstractFoxPlatformIntegrationTest { + + public final static String PROCESSES_XML = + "" + + + "" + + "" + + "true" + + "classpath:directory/" + + "" + + "" + + + ""; + + + @Deployment + public static WebArchive processArchive() { + + Asset pa2ProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML, + new String[][]{new String[]{"PA_NAME","PA2"}}); + + + Asset[] processAssets = TestHelper.generateProcessAssets(9); + + JavaArchive pa2 = ShrinkWrap.create(JavaArchive.class, "pa2.jar") + .addAsResource(pa2ProcessesXml, "META-INF/processes.xml"); + + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + + .addAsLibraries(pa2) + + .addAsResource(processAssets[0], "process0.bpmn") + .addAsResource(processAssets[1], "directory/process1.bpmn") + .addAsResource(processAssets[2], "alternateDirectory/process2.bpmn") + + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(deployment); + + return deployment; + + } + + @Test + public void testDeployProcessArchive() { + + assertProcessNotDeployed("process-0"); + assertProcessDeployed ("process-1", "PA2"); + assertProcessNotDeployed("process-2"); + + } + + protected void assertProcessNotDeployed(String processKey) { + + long count = repositoryService + .createProcessDefinitionQuery() + .latestVersion() + .processDefinitionKey(processKey) + .count(); + + Assert.assertEquals("Process with key "+processKey+ " should not be deployed", 0, count); + } + + protected void assertProcessDeployed(String processKey, String expectedDeploymentName) { + + ProcessDefinition processDefinition = repositoryService + .createProcessDefinitionQuery() + .latestVersion() + .processDefinitionKey(processKey) + .singleResult(); + + DeploymentQuery deploymentQuery = repositoryService + .createDeploymentQuery() + .deploymentId(processDefinition.getDeploymentId()); + + Assert.assertEquals(expectedDeploymentName, deploymentQuery.singleResult().getName()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment4.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment4.java new file mode 100644 index 0000000000000000000000000000000000000000..fd2d0d4da61b640666a616f8c7cb59d6392c9f90 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment4.java @@ -0,0 +1,153 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.junit.Assert; + +import org.camunda.bpm.engine.repository.DeploymentQuery; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.bpm.integrationtest.util.TestHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * + *
+ *   |-- My-Application.war
+ *       |-- WEB-INF
+ *           |-- classes
+ *               |-- META-INF/processes.xml 
+ *                      defines pa1 using classpath:directory/
+ *                      defines pa2 using classpath:alternateDirectory/
+ *               |-- process0.bpmn
+ *                   
+ *           |-- lib/
+ *               |-- pa2.jar 
+ *                   |-- process0.bpmn    
+ *                   |-- directory/process1.bpmn
+ *                       
+ *               |-- pa3.jar 
+ *                   |-- process0.bpmn 
+ *                   |-- alternateDirectory/process2.bpmn                   
+ * 
+ * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentWithMultiplePasAsSubdeployment4 extends AbstractFoxPlatformIntegrationTest { + + public final static String PROCESSES_XML = + "" + + + "" + + "" + + "true" + + "classpath:directory/" + + "" + + "" + + + "" + + "" + + "true" + + "classpath:alternateDirectory/" + + "" + + "" + + + ""; + + @Deployment + public static WebArchive processArchive() { + + Asset pa2ProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML, + new String[][]{}); + + + Asset[] processAssets = TestHelper.generateProcessAssets(9); + + JavaArchive pa2 = ShrinkWrap.create(JavaArchive.class, "pa2.jar") + .addAsResource(processAssets[0], "process0.bpmn") + .addAsResource(processAssets[1], "directory/process1.bpmn"); + + + JavaArchive pa3 = ShrinkWrap.create(JavaArchive.class, "pa3.jar") + .addAsResource(processAssets[0], "process0.bpmn") + .addAsResource(processAssets[2], "alternateDirectory/process2.bpmn"); + + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsResource(pa2ProcessesXml, "META-INF/processes.xml") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + + .addAsLibraries(pa2) + .addAsLibraries(pa3) + + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(deployment); + + return deployment; + } + + @Test + public void testDeployProcessArchive() { + + assertProcessNotDeployed("process-0"); + assertProcessDeployed ("process-1", "pa1"); + assertProcessDeployed ("process-2", "pa2"); + + } + + protected void assertProcessNotDeployed(String processKey) { + + long count = repositoryService + .createProcessDefinitionQuery() + .latestVersion() + .processDefinitionKey(processKey) + .count(); + + Assert.assertEquals("Process with key "+processKey+ " should not be deployed", 0, count); + } + + protected void assertProcessDeployed(String processKey, String expectedDeploymentName) { + + ProcessDefinition processDefinition = repositoryService + .createProcessDefinitionQuery() + .latestVersion() + .processDefinitionKey(processKey) + .singleResult(); + + DeploymentQuery deploymentQuery = repositoryService + .createDeploymentQuery() + .deploymentId(processDefinition.getDeploymentId()); + + Assert.assertEquals(expectedDeploymentName, deploymentQuery.singleResult().getName()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment5.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment5.java new file mode 100644 index 0000000000000000000000000000000000000000..bb3ee5e4d8206312cfe760ecfb1ccd82dab58d88 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithMultiplePasAsSubdeployment5.java @@ -0,0 +1,158 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.junit.Assert; + +import org.camunda.bpm.engine.repository.DeploymentQuery; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.bpm.integrationtest.util.TestHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + *

This test verifies that a WAR deployment can process multiple subdeployments that define process archives

+ * + *
+ *   |-- My-Application.war
+ *       |-- WEB-INF
+ *           |-- classes
+ *               |-- MEATA-INF/processes.xml               (1)
+ *                   |-- process0.bpmn    
+ *                   |-- directory/process1.bpmn
+ *                   |-- alternateDirectory/process2.bpmn 
+ *           |-- lib/
+ *               |-- pa2.jar 
+ *                   |-- process3.bpmn    
+ *                   |-- directory/process4.bpmn
+ *                   |-- alternateDirectory/process5.bpmn
+ *                    
+ *               |-- pa3.jar
+ *                   |-- process6.bpmn    
+ *                   |-- directory/process7.bpmn
+ *                   |-- alternateDirectory/process8.bpmn
+ * 
+ * + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentWithMultiplePasAsSubdeployment5 extends AbstractFoxPlatformIntegrationTest { + + public final static String PROCESSES_XML = + "" + + + "" + + "" + + "true" + + "" + + "" + + + ""; + + @Deployment + public static WebArchive processArchive() { + + Asset pa1ProcessesXml = TestHelper.getStringAsAssetWithReplacements( + PROCESSES_XML, + new String[][]{new String[]{"PA_NAME","PA1"}}); + + Asset[] processAssets = TestHelper.generateProcessAssets(9); + + JavaArchive pa2 = ShrinkWrap.create(JavaArchive.class, "pa2.jar") + .addAsResource(processAssets[3], "process3.bpmn") + .addAsResource(processAssets[4], "directory/process4.bpmn") + .addAsResource(processAssets[5], "alternateDirectory/process5.bpmn"); + + JavaArchive pa3 = ShrinkWrap.create(JavaArchive.class, "pa3.jar") + .addAsResource(processAssets[6], "process6.bpmn") + .addAsResource(processAssets[7], "directory/process7.bpmn") + .addAsResource(processAssets[8], "alternateDirectory/process8.bpmn"); + + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + + .addAsLibraries(pa2) + .addAsLibraries(pa3) + + .addAsResource(pa1ProcessesXml, "META-INF/processes.xml") + .addAsResource(processAssets[0], "process0.bpmn") + .addAsResource(processAssets[1], "directory/process1.bpmn") + .addAsResource(processAssets[2], "alternateDirectory/process2.bpmn") + + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(deployment); + + return deployment; + } + + @Test + public void testDeployProcessArchive() { + + assertProcessDeployed("process-0", "PA1"); + assertProcessDeployed("process-1", "PA1"); + assertProcessDeployed("process-2", "PA1"); + assertProcessNotDeployed("process-3"); + assertProcessNotDeployed("process-4"); + assertProcessNotDeployed("process-5"); + assertProcessNotDeployed("process-6"); + assertProcessNotDeployed("process-7"); + assertProcessNotDeployed("process-8"); + + } + + protected void assertProcessDeployed(String processKey, String expectedDeploymentName) { + + ProcessDefinition processDefinition = repositoryService + .createProcessDefinitionQuery() + .latestVersion() + .processDefinitionKey(processKey) + .singleResult(); + + DeploymentQuery deploymentQuery = repositoryService + .createDeploymentQuery() + .deploymentId(processDefinition.getDeploymentId()); + + Assert.assertEquals(expectedDeploymentName, deploymentQuery.singleResult().getName()); + + } + + protected void assertProcessNotDeployed(String processKey) { + + long count = repositoryService + .createProcessDefinitionQuery() + .latestVersion() + .processDefinitionKey(processKey) + .count(); + + Assert.assertEquals("Process with key "+processKey+ " should not be deployed", 0, count); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithNonExistingDS_JBOSS.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithNonExistingDS_JBOSS.java new file mode 100644 index 0000000000000000000000000000000000000000..2f7894c1574111316d7965a8ca1070afae772238 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithNonExistingDS_JBOSS.java @@ -0,0 +1,97 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + + +import org.camunda.bpm.integrationtest.deployment.war.apps.CustomServletPA; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.RunAsClient; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + *

This test makes sure that if we deploy a process application which contains a persistence.xml + * file which references a non existing datasource, the MSC does not run into a deadlock.

+ * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentWithNonExistingDS_JBOSS { + + private static final String DEPLOYMENT_WITH_EJB_PA = "deployment-with-EJB-PA"; + private static final String DEPLOYMENT_WITH_SERVLET_PA = "deployment-with-SERVLET-PA"; + + @ArquillianResource + private Deployer deployer; + + @Deployment(managed=false, name=DEPLOYMENT_WITH_EJB_PA) + public static WebArchive createDeployment1() { + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test1.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addAsResource("persistence-nonexisting-ds.xml", "META-INF/persistence.xml"); + + TestContainer.addContainerSpecificResources(archive); + + return archive; + } + + @Deployment(managed=false, name=DEPLOYMENT_WITH_SERVLET_PA) + public static WebArchive createDeployment2() { + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test2.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addAsResource("persistence-nonexisting-ds.xml", "META-INF/persistence.xml") + + .addClass(CustomServletPA.class); + + return archive; + } + + @Test + @RunAsClient + public void testDeploymentFails(){ + + try { + deployer.deploy(DEPLOYMENT_WITH_EJB_PA); + Assert.fail("Deployment exception expected"); + } catch(Exception e) { + // expected + } + + try { + deployer.deploy(DEPLOYMENT_WITH_SERVLET_PA); + Assert.fail("Deployment exception expected"); + } catch(Exception e) { + // expected + } + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithProcessEnginePlugin.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithProcessEnginePlugin.java new file mode 100644 index 0000000000000000000000000000000000000000..938ef40374117bbbcac7c77b0ea683f2c7b5f821 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithProcessEnginePlugin.java @@ -0,0 +1,84 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.history.HistoricProcessInstance; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.deployment.war.beans.GroovyProcessEnginePlugin; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.jboss.shrinkwrap.resolver.api.maven.Maven; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.assertEquals; + + +/** + * Assert that we can deploy a WAR with a process engine plugin + * which ships and requires groovy as a dependency for scripting purposes. + * + * Does not work on JBoss, see https://app.camunda.com/jira/browse/CAM-1778 + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentWithProcessEnginePlugin extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment("test.war", "singleEngineWithProcessEnginePlugin.xml") + .addClass(GroovyProcessEnginePlugin.class) + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/groovy.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/deployment/war/groovyAsync.bpmn20.xml") + .addAsLibraries(Maven.resolver() + .offline() + .loadPomFromFile("pom.xml") + .resolve("org.apache.groovy:groovy-jsr223") + .withoutTransitivity() + .as(JavaArchive.class)); + } + + @Test + public void testPAGroovyProcessEnginePlugin() { + ProcessEngine groovyEngine = processEngineService.getProcessEngine("groovy"); + Assert.assertNotNull(groovyEngine); + + ProcessInstance pi = groovyEngine.getRuntimeService().startProcessInstanceByKey("groovy"); + HistoricProcessInstance hpi = groovyEngine.getHistoryService() + .createHistoricProcessInstanceQuery().processDefinitionKey("groovy").finished().singleResult(); + assertEquals(pi.getId(), hpi.getId()); + } + + @Test + public void testPAGroovyAsyncProcessEnginePlugin() { + ProcessEngine groovyEngine = processEngineService.getProcessEngine("groovy"); + Assert.assertNotNull(groovyEngine); + + ProcessInstance pi = groovyEngine.getRuntimeService().startProcessInstanceByKey("groovyAsync"); + + waitForJobExecutorToProcessAllJobs(); + + HistoricProcessInstance hpi = groovyEngine.getHistoryService() + .createHistoricProcessInstanceQuery().processDefinitionKey("groovyAsync").finished().singleResult(); + assertEquals(pi.getId(), hpi.getId()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithoutDiagram.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithoutDiagram.java new file mode 100644 index 0000000000000000000000000000000000000000..f9a0d908b2e96bc440890ddfebda9cdd59a4592d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithoutDiagram.java @@ -0,0 +1,50 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; + +import java.io.IOException; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestHelper; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * @author Christian Lipphardt + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentWithoutDiagram extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(TestHelper.class) + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml"); + } + + @Test + public void testDeployProcessArchiveDiagramCreationDisabled() throws IOException { + String expectedDiagramResource = "/org/camunda/bpm/integrationtest/testDeployProcessArchive.png"; + String processDefinitionKey = "testDeployProcessArchive"; + TestHelper.assertDiagramIsDeployed(false, getClass(), expectedDiagramResource, processDefinitionKey); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithoutProcessDefinitions.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithoutProcessDefinitions.java new file mode 100644 index 0000000000000000000000000000000000000000..0cf2ac544af6067962078e8fdddd4bc9550fccb6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithoutProcessDefinitions.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * Assert that we can deploy a WAR with a processes.xml but no process definitions. + * + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentWithoutProcessDefinitions extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment(); + } + + @Test + public void testDeployProcessArchive() { + Assert.assertNotNull(ProgrammaticBeanLookup.lookup(ProcessEngine.class)); + + // no deployment has been constructed + Assert.assertEquals(0, repositoryService.createDeploymentQuery().deploymentName("pa").count()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithoutProcessesXml.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithoutProcessesXml.java new file mode 100644 index 0000000000000000000000000000000000000000..1e8c07b22000511a3dca7def3db7c0a3bd8b3f66 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/TestWarDeploymentWithoutProcessesXml.java @@ -0,0 +1,58 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * Assert that we can deploy a WAR which bundles + * the client but does not include a processes.xml + * + */ +@RunWith(Arquillian.class) +public class TestWarDeploymentWithoutProcessesXml extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(deployment); + + return deployment; + + } + + @Test + public void testDeployProcessArchive() { + Assert.assertNotNull(ProgrammaticBeanLookup.lookup(ProcessEngine.class)); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/apps/CustomNameServletPA.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/apps/CustomNameServletPA.java new file mode 100644 index 0000000000000000000000000000000000000000..d9b28b251f69fe5e1e17a598b4adf9701112e10f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/apps/CustomNameServletPA.java @@ -0,0 +1,30 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war.apps; + +import org.camunda.bpm.application.ProcessApplication; + +/** + * @author Thorben Lindhauer + * + */ +@ProcessApplication(name = CustomNameServletPA.NAME) +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class CustomNameServletPA extends org.camunda.bpm.application.impl.ServletProcessApplication { + + public static final String NAME = "fooooooooooooo"; +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/apps/CustomServletPA.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/apps/CustomServletPA.java new file mode 100644 index 0000000000000000000000000000000000000000..4102943f9cde80e96d1a091515efddadba16fac3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/apps/CustomServletPA.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war.apps; + +import org.camunda.bpm.application.ProcessApplication; + +/** + * @author Daniel Meyer + * + */ +@ProcessApplication +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class CustomServletPA extends org.camunda.bpm.application.impl.ServletProcessApplication { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/beans/GroovyProcessEnginePlugin.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/beans/GroovyProcessEnginePlugin.java new file mode 100644 index 0000000000000000000000000000000000000000..762853eda59cc49a858e470bdbf59268131b1828 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/deployment/war/beans/GroovyProcessEnginePlugin.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.deployment.war.beans; + +import javax.script.ScriptEngineManager; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin; +import org.camunda.bpm.engine.impl.scripting.engine.DefaultScriptEngineResolver; +import org.camunda.bpm.engine.impl.scripting.engine.ScriptBindingsFactory; +import org.camunda.bpm.engine.impl.scripting.engine.ScriptingEngines; + +public class GroovyProcessEnginePlugin implements ProcessEnginePlugin { + + @Override + public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { + + } + + @Override + public void postInit(ProcessEngineConfigurationImpl processEngineConfiguration) { + processEngineConfiguration.setScriptingEngines( + new ScriptingEngines( + new ScriptBindingsFactory(processEngineConfiguration.getResolverFactories()), + new DefaultScriptEngineResolver(new ScriptEngineManager()) + ) + ); + } + + @Override + public void postProcessEngineBuild(ProcessEngine processEngine) { + + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/bpmnmodelapi/DelegationCodeBpmnModelRetrievalTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/bpmnmodelapi/DelegationCodeBpmnModelRetrievalTest.java new file mode 100644 index 0000000000000000000000000000000000000000..18e770e55e5a2281aded7ab052138165d5c39880 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/bpmnmodelapi/DelegationCodeBpmnModelRetrievalTest.java @@ -0,0 +1,66 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.bpmnmodelapi; + +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.integrationtest.functional.bpmnmodelapi.beans.BpmnElementRetrievalDelegate; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class DelegationCodeBpmnModelRetrievalTest extends AbstractFoxPlatformIntegrationTest { + + private static final String TEST_PROCESS = "testProcess"; + + @Deployment + public static WebArchive createProcessApplication() { + BpmnModelInstance process = Bpmn.createExecutableProcess(TEST_PROCESS) + .camundaHistoryTimeToLive(180) + .startEvent() + .serviceTask() + .camundaDelegateExpression("${bpmnElementRetrievalDelegate}") + .done(); + + return initWebArchiveDeployment() + .addClass(BpmnElementRetrievalDelegate.class) + .addAsResource(new StringAsset(Bpmn.convertToString(process)), "testProcess.bpmn20.xml"); + } + + @Test + public void shouldReturnBpmnModelInstance() { + + runtimeService.startProcessInstanceByKey(TEST_PROCESS); + + BpmnElementRetrievalDelegate delegate = ProgrammaticBeanLookup.lookup(BpmnElementRetrievalDelegate.class); + + Assert.assertNotNull(delegate.getBpmnModelElementInstance()); + Assert.assertNotNull(delegate.getBpmnModelInstance()); + Assert.assertEquals(TEST_PROCESS, delegate.getBpmnModelInstance().getDefinitions().getRootElements().iterator().next().getId()); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/bpmnmodelapi/RepositoryServiceBpmnModelRetrievalTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/bpmnmodelapi/RepositoryServiceBpmnModelRetrievalTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b935c8fa4013f4d7ce507a599490dce41da7ee25 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/bpmnmodelapi/RepositoryServiceBpmnModelRetrievalTest.java @@ -0,0 +1,57 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.bpmnmodelapi; + +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class RepositoryServiceBpmnModelRetrievalTest extends AbstractFoxPlatformIntegrationTest { + + private static final String TEST_PROCESS = "testProcess"; + + @Deployment + public static WebArchive createProcessApplication() { + return initWebArchiveDeployment() + .addAsResource(new StringAsset(Bpmn.convertToString(Bpmn.createExecutableProcess(TEST_PROCESS).camundaHistoryTimeToLive(180).startEvent().done())), "testProcess.bpmn20.xml"); + } + + @Test + public void shouldReturnBpmnModelInstance() { + + ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey(TEST_PROCESS) + .singleResult(); + + BpmnModelInstance bpmnModelInstance = repositoryService.getBpmnModelInstance(processDefinition.getId()); + Assert.assertNotNull(bpmnModelInstance); + + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/bpmnmodelapi/beans/BpmnElementRetrievalDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/bpmnmodelapi/beans/BpmnElementRetrievalDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..fcf75ebaf3f357f894acfa76b0660e7ee689fa90 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/bpmnmodelapi/beans/BpmnElementRetrievalDelegate.java @@ -0,0 +1,54 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.bpmnmodelapi.beans; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.camunda.bpm.model.bpmn.instance.FlowElement; + +/** + * @author Daniel Meyer + * + */ +@Named +@ApplicationScoped +public class BpmnElementRetrievalDelegate implements JavaDelegate { + + private FlowElement bpmnModelElementInstance; + private BpmnModelInstance bpmnModelInstance; + + @Override + public void execute(DelegateExecution execution) throws Exception { + + bpmnModelElementInstance = execution.getBpmnModelElementInstance(); + bpmnModelInstance = execution.getBpmnModelInstance(); + + } + + public FlowElement getBpmnModelElementInstance() { + return bpmnModelElementInstance; + } + + public BpmnModelInstance getBpmnModelInstance() { + return bpmnModelInstance; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanCallActivityResolutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanCallActivityResolutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bd53377ce96ce8288b3e6cee6704076e397bc39d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanCallActivityResolutionTest.java @@ -0,0 +1,117 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.integrationtest.functional.cdi.beans.ConditionalFlowBean; +import org.camunda.bpm.integrationtest.functional.cdi.beans.ProcessVariableBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.After; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class CdiBeanCallActivityResolutionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name="pa1") + public static WebArchive createCallingProcessDeployment() { + return initWebArchiveDeployment("pa1.war") + .addClass(ConditionalFlowBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiBeanCallActivityResolutionTest.callingProcess.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiBeanCallActivityResolutionTest.callingProcessConditionalFlow.bpmn20.xml"); + + } + + @Deployment(name="pa2") + public static WebArchive createCalledProcessDeployment() { + return initWebArchiveDeployment("pa2.war") + .addClass(ProcessVariableBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiBeanCallActivityResolutionTest.calledProcess.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPa(deployment); + + return deployment; + } + + protected ProcessInstance processInstance; + + @After + public void tearDown() { + if (processInstance != null) { + runtimeService.deleteProcessInstance(processInstance.getId(), null); + } + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveBeanInBpmnProcess() { + processInstance = runtimeService.startProcessInstanceByKey("callingProcess"); + + Task calledProcessTask = taskService.createTaskQuery().singleResult(); + + taskService.complete(calledProcessTask.getId(), + Variables.createVariables().putValue("var", "value")); + + Task afterCallActivityTask = taskService.createTaskQuery().singleResult(); + Assert.assertNotNull(afterCallActivityTask); + Assert.assertEquals("afterCallActivity", afterCallActivityTask.getTaskDefinitionKey()); + + String variable = (String) runtimeService.getVariable(processInstance.getId(), "var"); + Assert.assertEquals("valuevalue", variable); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveBeanInBpmnProcessConditionalFlow() { + // given + processInstance = runtimeService.startProcessInstanceByKey("callingProcessConditionalFlow", + Variables.createVariables().putValue("takeFlow", true)); + + Task calledProcessTask = taskService.createTaskQuery().singleResult(); + + // when + taskService.complete(calledProcessTask.getId()); + + // then + Task afterCallActivityTask = taskService.createTaskQuery().singleResult(); + Assert.assertNotNull(afterCallActivityTask); + Assert.assertEquals("afterCallActivityTask", afterCallActivityTask.getTaskDefinitionKey()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanCaseTaskResolutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanCaseTaskResolutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4f39ab38d26f16add2cd14482d3b1c6eeb792f49 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanCaseTaskResolutionTest.java @@ -0,0 +1,94 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi; + +import org.camunda.bpm.engine.runtime.CaseExecution; +import org.camunda.bpm.engine.runtime.CaseInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.integrationtest.functional.cdi.beans.CaseVariableBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class CdiBeanCaseTaskResolutionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name="pa1") + public static WebArchive createCallingProcessDeployment() { + return initWebArchiveDeployment("pa1.war") + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiBeanCallActivityResolutionTest.callingCase.cmmn"); + } + + @Deployment(name="pa2") + public static WebArchive createCalledProcessDeployment() { + return initWebArchiveDeployment("pa2.war") + .addClass(CaseVariableBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiBeanCallActivityResolutionTest.calledCase.cmmn"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment); + + return deployment; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveBeanInCmmnCase() { + CaseInstance caseInstance = caseService.withCaseDefinitionByKey("callingCase") + .create(); + + CaseExecution caseTaskInstance = caseService.createCaseExecutionQuery().activityId("PI_CaseTask_1") + .singleResult(); + + CaseExecution calledCaseHumanTaskInstance = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1") + .singleResult(); + + Task calledCaseTask = taskService.createTaskQuery().singleResult(); + + taskService.complete(calledCaseTask.getId(), + Variables.createVariables().putValue("var", "value")); + + CaseInstance calledInstance = caseService.createCaseInstanceQuery() + .caseDefinitionKey("calledCase").singleResult(); + + caseService.withCaseExecution(calledInstance.getId()).close(); + + // then + String variable = (String) caseService.getVariable(caseInstance.getId(), "var"); + Assert.assertEquals("valuevalue", variable); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanDependentScopedAsyncTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanDependentScopedAsyncTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6b48ed576972bcdb2d5b3e06e48fa2868e784357 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanDependentScopedAsyncTest.java @@ -0,0 +1,82 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi; + +import org.camunda.bpm.integrationtest.functional.cdi.beans.DependentScopedBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.Arrays; + +/** + * @author Tassilo Weidner + */ +@RunWith(Arquillian.class) +public class CdiBeanDependentScopedAsyncTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(DependentScopedBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiBeanDependentScoped.testResolveBeanFromJobExecutor.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(DependentScopedBean.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment); + + return deployment; + } + + @Before + @OperateOnDeployment("clientDeployment") + public void setup() { + DependentScopedBean.reset(); + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + + runtimeService.startProcessInstanceByKey("testResolveBeanFromJobExecutor"); + + Assert.assertEquals(1,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + } + + @Test + public void testResolveBeanFromJobExecutor() { + Assert.assertEquals(Arrays.asList("post-construct-invoked", "bean-invoked", "pre-destroy-invoked"), DependentScopedBean.lifecycle); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanDependentScopedSyncTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanDependentScopedSyncTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7936a69cb8726fa64baa3939f999e5c74df6df50 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanDependentScopedSyncTest.java @@ -0,0 +1,78 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi; + +import org.camunda.bpm.integrationtest.functional.cdi.beans.DependentScopedBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.Arrays; + +/** + * @author Tassilo Weidner + */ +@RunWith(Arquillian.class) +public class CdiBeanDependentScopedSyncTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(DependentScopedBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiBeanDependentScoped.testResolveBean.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(DependentScopedBean.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment); + + return deployment; + } + + @Before + @OperateOnDeployment("clientDeployment") + public void setup() { + DependentScopedBean.reset(); + + Assert.assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count()); + + runtimeService.startProcessInstanceByKey("testResolveBean"); + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count()); + } + + @Test + public void testResolveBean() { + Assert.assertEquals(Arrays.asList("post-construct-invoked", "bean-invoked", "pre-destroy-invoked"), DependentScopedBean.lifecycle); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanResolutionOnDeploymentTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanResolutionOnDeploymentTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4cad47d280cd5c3cab556ae8bbe85bcb63fd451e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanResolutionOnDeploymentTest.java @@ -0,0 +1,65 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi; + +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.integrationtest.functional.cdi.beans.TimerStartBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class CdiBeanResolutionOnDeploymentTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(TimerStartBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiBeanResolutionOnDeploymentTest.testTimerStartWithBeanExpression.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPa(deployment); + + return deployment; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testTimerStartWithBeanExpression() { + ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); + Assert.assertNotNull(processDefinition); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanResolutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanResolutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..954831f41f5789a3033997860a2bb3f3c8e615b4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanResolutionTest.java @@ -0,0 +1,103 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi; + +import org.camunda.bpm.engine.cdi.CdiStandaloneProcessEngineConfiguration; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.integrationtest.functional.cdi.beans.ExampleBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + *

Deploys two different applications, a process archive and a client application.

+ * + *

This test ensures that when the process is started from the client, + * it is able to make the context switch to the process archive and resolve cdi beans + * from the process archive.

+ * + * + * @author Daniel Meyer + */ +@RunWith(Arquillian.class) +public class CdiBeanResolutionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(ExampleBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiBeanResolutionTest.testResolveBean.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiBeanResolutionTest.testResolveBeanFromJobExecutor.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment); + + return deployment; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveBean() { + // assert that we cannot resolve the bean here: + Assert.assertNull(ProgrammaticBeanLookup.lookup("exampleBean")); + + Assert.assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count()); + // but the process engine can: + runtimeService.startProcessInstanceByKey("testResolveBean"); + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveBeanFromJobExecutor() { + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + runtimeService.startProcessInstanceByKey("testResolveBeanFromJobExecutor"); + Assert.assertEquals(1,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveCdiStandaloneProcessEngineConfigBean() { + + Assert.assertNotNull(ProgrammaticBeanLookup.lookup(CdiStandaloneProcessEngineConfiguration.class)); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanResolutionTwoEnginesTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanResolutionTwoEnginesTest.java new file mode 100644 index 0000000000000000000000000000000000000000..649cbc55fef0edaace104837cdf54d1c4689767d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanResolutionTwoEnginesTest.java @@ -0,0 +1,96 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi; + +import java.util.Arrays; +import java.util.List; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.authorization.Authorization; +import org.camunda.bpm.engine.authorization.Permission; +import org.camunda.bpm.engine.authorization.Permissions; +import org.camunda.bpm.engine.authorization.Resources; +import org.camunda.bpm.engine.runtime.VariableInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class CdiBeanResolutionTwoEnginesTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name= "engine1", order = 1) + public static WebArchive createDeployment() { + final WebArchive webArchive = initWebArchiveDeployment("paEngine1.war", "org/camunda/bpm/integrationtest/paOnEngine1.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiBeanResolutionTwoEnginesTest.testResolveBean.bpmn20.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificProcessEngineConfigurationClass(webArchive); + return webArchive; + } + + @Test + @OperateOnDeployment("engine1") + public void testResolveBean() throws Exception { + //given + final ProcessEngine processEngine1 = processEngineService.getProcessEngine("engine1"); + Assert.assertEquals("engine1", processEngine1.getName()); + createAuthorizations(processEngine1); + + //when we operate the process under authenticated user + processEngine1.getIdentityService().setAuthentication("user1", Arrays.asList("group1")); + + processEngine1.getRuntimeService().startProcessInstanceByKey("testProcess"); + final List tasks = processEngine1.getTaskService().createTaskQuery().list(); + Assert.assertEquals(1, tasks.size()); + processEngine1.getTaskService().complete(tasks.get(0).getId()); + + //then + //identityService resolution respects the engine, on which the process is being executed + final List variableInstances = processEngine1.getRuntimeService().createVariableInstanceQuery().variableName("changeInitiatorUsername") + .list(); + Assert.assertEquals(1, variableInstances.size()); + Assert.assertEquals("user1", variableInstances.get(0).getValue()); + } + + private void createAuthorizations(ProcessEngine processEngine1) { + Authorization newAuthorization = processEngine1.getAuthorizationService().createNewAuthorization(Authorization.AUTH_TYPE_GLOBAL); + newAuthorization.setResource(Resources.PROCESS_INSTANCE); + newAuthorization.setResourceId("*"); + newAuthorization.setPermissions(new Permission[] { Permissions.CREATE }); + processEngine1.getAuthorizationService().saveAuthorization(newAuthorization); + + newAuthorization = processEngine1.getAuthorizationService().createNewAuthorization(Authorization.AUTH_TYPE_GLOBAL); + newAuthorization.setResource(Resources.PROCESS_DEFINITION); + newAuthorization.setResourceId("*"); + newAuthorization.setPermissions(new Permission[] { Permissions.CREATE_INSTANCE }); + processEngine1.getAuthorizationService().saveAuthorization(newAuthorization); + + newAuthorization = processEngine1.getAuthorizationService().createNewAuthorization(Authorization.AUTH_TYPE_GLOBAL); + newAuthorization.setResource(Resources.TASK); + newAuthorization.setResourceId("*"); + newAuthorization.setPermissions(new Permission[] { Permissions.READ, Permissions.TASK_WORK }); + processEngine1.getAuthorizationService().saveAuthorization(newAuthorization); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanSignallableActivityBehaviorResolutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanSignallableActivityBehaviorResolutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6bcfe45e0df9f97756fba0e114aa9d93738a68d3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiBeanSignallableActivityBehaviorResolutionTest.java @@ -0,0 +1,75 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi; + +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.cdi.beans.ExampleSignallableActivityBehaviorBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class CdiBeanSignallableActivityBehaviorResolutionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeplyoment() { + return initWebArchiveDeployment() + .addClass(ExampleSignallableActivityBehaviorBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiBeanSignallableActivityBehaviorResolutionTest.testResolveBean.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment); + + return deployment; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveClass() { + // assert that we cannot resolve the bean here: + Assert.assertNull(ProgrammaticBeanLookup.lookup("exampleSignallableActivityBehaviorBean")); + + // but the process can since it performs context switch to the process archive for execution + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testResolveBean"); + + runtimeService.signal(processInstance.getId()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiCallActivityVersionTagTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiCallActivityVersionTagTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7f6a1035ecbd78dffb8d6da4b19ed0200a3b6e0f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiCallActivityVersionTagTest.java @@ -0,0 +1,67 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi; + +import static org.junit.Assert.assertNotNull; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.cdi.beans.VersionTagBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class CdiCallActivityVersionTagTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeployment() { + return initWebArchiveDeployment() + .addClass(VersionTagBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiCallActivityVersionTagTest.subProcess.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiCallActivityVersionTagTest.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment); + + return deployment; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testStartInstanceWithBeanCondition() { + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process"); + + // then + ProcessInstance subInstance = runtimeService.createProcessInstanceQuery().processDefinitionKey("subProcess").superProcessInstanceId(processInstance.getId()).singleResult(); + assertNotNull(subInstance); + + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiDelegateBeanResolutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiDelegateBeanResolutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3774cfb12d2c8d5ec599b6a3a1cc0fa8d2b4f2d8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiDelegateBeanResolutionTest.java @@ -0,0 +1,100 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi; +import org.camunda.bpm.engine.cdi.impl.util.BeanManagerLookup; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.integrationtest.functional.cdi.beans.ExampleDelegateBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + *

Deploys two different applications, a process archive and a cleint application.

+ * + *

This test ensures that when the process is started from the client, + * it is able to make the context switch to the process archvie and resolve cdi beans + * from the process archive.

+ * + * + * @author Daniel Meyer + */ +@RunWith(Arquillian.class) +public class CdiDelegateBeanResolutionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(ExampleDelegateBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiDelegateBeanResolutionTest.testResolveBean.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/CdiDelegateBeanResolutionTest.testResolveBeanFromJobExecutor.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(ProgrammaticBeanLookup.class) + .addClass(BeanManagerLookup.class) + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesEmbedCdiLib(webArchive); + + return webArchive; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveBean() { + try { + // assert that we cannot resolve the bean here: + ProgrammaticBeanLookup.lookup("exampleDelegateBean"); + Assert.fail("exception expected"); + }catch (Throwable e) { + // expected + } + + Assert.assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count()); + // but the process engine can: + runtimeService.startProcessInstanceByKey("testResolveBean"); + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveBeanFromJobExecutor() { + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + runtimeService.startProcessInstanceByKey("testResolveBeanFromJobExecutor"); + Assert.assertEquals(1,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiRetryConfigurationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiRetryConfigurationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..42cb25f791ae69ef94e8e5e343f174a38ef61101 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/CdiRetryConfigurationTest.java @@ -0,0 +1,84 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi; + +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.JobQuery; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.cdi.beans.DependentScopedBean; +import org.camunda.bpm.integrationtest.functional.cdi.beans.ErrorDelegate; +import org.camunda.bpm.integrationtest.functional.cdi.beans.RetryConfig; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class CdiRetryConfigurationTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeployment() { + return initWebArchiveDeployment() + .addClass(ErrorDelegate.class) + .addClass(RetryConfig.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/RetryConfigurationTest.testResolveRetryConfigBean.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(DependentScopedBean.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment); + + return deployment; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveBean() { + // given + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testRetry"); + + JobQuery query = managementService + .createJobQuery() + .processInstanceId(processInstance.getId()); + + Job job = query.singleResult(); + + // when job fails + try { + managementService.executeJob(job.getId()); + } catch (Exception e) { + // ignore + } + + // then + job = query.singleResult(); + Assert.assertEquals(6, job.getRetries()); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/JobExecutorRequestContextTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/JobExecutorRequestContextTest.java new file mode 100644 index 0000000000000000000000000000000000000000..add7ae51fd2f406427610a548f4419349cb08e91 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/JobExecutorRequestContextTest.java @@ -0,0 +1,124 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.functional.cdi.beans.RequestScopedDelegateBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * These test cases verify that the CDI RequestContext is active, + * when the job executor executes a job and is scoped as expected + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class JobExecutorRequestContextTest extends AbstractFoxPlatformIntegrationTest { + + /** + * + */ + private static final int _6000 = 6000; + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(RequestScopedDelegateBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/JobExecutorRequestContextTest.testResolveBean.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/JobExecutorRequestContextTest.testScoping.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/cdi/JobExecutorRequestContextTest.testScopingExclusiveJobs.bpmn20.xml"); + } + + + @Test + public void testResolveBean() { + + // verifies that @RequestScoped Beans can be resolved + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testResolveBean"); + + waitForJobExecutorToProcessAllJobs(); + + Object variable = runtimeService.getVariable(pi.getId(), "invocationCounter"); + Assert.assertEquals(1, variable); + } + + @Test + public void testScoping() { + + // verifies that if the same @RequestScoped Bean is invoked multiple times + // in the context of the same job, we get the same instance + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testScoping"); + + waitForJobExecutorToProcessAllJobs(); + + Object variable = runtimeService.getVariable(pi.getId(), "invocationCounter"); + // -> the same bean instance was invoked 2 times! + Assert.assertEquals(2, variable); + + Task task = taskService.createTaskQuery() + .processInstanceId(pi.getProcessInstanceId()) + .singleResult(); + taskService.complete(task.getId()); + + waitForJobExecutorToProcessAllJobs(); + + variable = runtimeService.getVariable(pi.getId(), "invocationCounter"); + // now it's '1' again! -> new instance of the bean + Assert.assertEquals(1, variable); + + } + + @Test + public void testScopingExclusiveJobs() { + + // verifies that if the same @RequestScoped Bean is invoked + // in the context of two subsequent exclusive jobs, we have + // seperate requests for each job, eben if the jobs are executed + // subsequently by the same thread. + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testScopingExclusiveJobs"); + + waitForJobExecutorToProcessAllJobs(); + + Object variable = runtimeService.getVariable(pi.getId(), "invocationCounter"); + // -> seperate requests + Assert.assertEquals(1, variable); + + Task task = taskService.createTaskQuery() + .processInstanceId(pi.getProcessInstanceId()) + .singleResult(); + taskService.complete(task.getId()); + + waitForJobExecutorToProcessAllJobs(); + + variable = runtimeService.getVariable(pi.getId(), "invocationCounter"); + Assert.assertEquals(1, variable); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/CaseVariableBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/CaseVariableBean.java new file mode 100644 index 0000000000000000000000000000000000000000..06200099b5edb628fd29249831f0d8c36634b41a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/CaseVariableBean.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi.beans; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.camunda.bpm.engine.CaseService; +import org.camunda.bpm.engine.delegate.DelegateCaseExecution; + +/** + * @author Thorben Lindhauer + * + */ +@Named +public class CaseVariableBean { + + @Inject + protected CaseService caseService; + + public String getNewValue(DelegateCaseExecution caseExecution) { + Object variableValue = caseService.getVariable(caseExecution.getId(), "var"); + + return variableValue.toString() + variableValue.toString(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ConditionalFlowBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ConditionalFlowBean.java new file mode 100644 index 0000000000000000000000000000000000000000..32cba9cbf4eedb7dc5e7f142916f0e9fcb0b0ce0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ConditionalFlowBean.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi.beans; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.runtime.ProcessInstance; + +/** + * @author Thorben Lindhauer + * + */ +@Named +public class ConditionalFlowBean { + + @Inject + protected ProcessInstance processInstance; + + @Inject + protected RuntimeService runtimeService; + + public boolean shouldTakeFlow() { + Object takeFlow = runtimeService.getVariable(processInstance.getId(), "takeFlow"); + + return Boolean.TRUE.equals(takeFlow); + } + } diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/DependentScopedBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/DependentScopedBean.java new file mode 100644 index 0000000000000000000000000000000000000000..dd01e9c401c6d55df5bf5d3109fd90aeec3ada45 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/DependentScopedBean.java @@ -0,0 +1,52 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi.beans; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.enterprise.context.Dependent; +import javax.inject.Named; +import java.util.ArrayList; + +/** + * @author Tassilo Weidner + */ +@Named +@Dependent +public class DependentScopedBean { + + public static ArrayList lifecycle = new ArrayList(); + + public void invoke() { + lifecycle.add("bean-invoked"); + } + + public static void reset() { + lifecycle.clear(); + } + + @PreDestroy + public void preDestroy() { + lifecycle.add("pre-destroy-invoked"); + } + + @PostConstruct + public void postContruct() { + lifecycle.add("post-construct-invoked"); + } + +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ErrorDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ErrorDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..52b13732f590280a8e654e4c0ff2d51b3dc764b4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ErrorDelegate.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi.beans; + +import javax.inject.Named; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +@Named +public class ErrorDelegate implements JavaDelegate { + + @Override + public void execute(DelegateExecution execution) throws Exception { + throw new RuntimeException("I'm supposed to fail!"); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ExampleBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ExampleBean.java new file mode 100644 index 0000000000000000000000000000000000000000..58823e84838be0b8c08d1bef54132f4b270d43f1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ExampleBean.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi.beans; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; + +@Named +@ApplicationScoped +public class ExampleBean { + + protected boolean invoked; + + public void invoke() { + this.invoked = true; + } + + public boolean isInvoked() { + return invoked; + } + + public void setInvoked(boolean invoked) { + this.invoked = invoked; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ExampleDelegateBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ExampleDelegateBean.java new file mode 100644 index 0000000000000000000000000000000000000000..f18dee3e116bfed7cb63577809abfae582f25951 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ExampleDelegateBean.java @@ -0,0 +1,42 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi.beans; + +import javax.inject.Named; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +@Named +public class ExampleDelegateBean implements JavaDelegate { + + public static boolean invoked; + + public boolean isInvoked() { + return invoked; + } + + public void setInvoked(boolean invoked) { + ExampleDelegateBean.invoked = invoked; + } + + @Override + public void execute(DelegateExecution execution) throws Exception { + invoked = true; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ExampleSignallableActivityBehaviorBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ExampleSignallableActivityBehaviorBean.java new file mode 100644 index 0000000000000000000000000000000000000000..6a028bcee0d3daf87c2f8a7488ba64ef5862a56b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ExampleSignallableActivityBehaviorBean.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi.beans; + +import javax.inject.Named; + +import org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior; +import org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution; +import org.camunda.bpm.engine.impl.pvm.delegate.SignallableActivityBehavior; + +/** + * @author Daniel Meyer + * + */ +@Named +public class ExampleSignallableActivityBehaviorBean extends AbstractBpmnActivityBehavior implements SignallableActivityBehavior { + + public void execute(ActivityExecution execution) throws Exception { + + } + + public void signal(ActivityExecution execution, String signalEvent, Object signalData) throws Exception { + leave(execution); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ProcessVariableBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ProcessVariableBean.java new file mode 100644 index 0000000000000000000000000000000000000000..b6dfbd479ed504ed3ad7122f119abdd40c82105a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/ProcessVariableBean.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi.beans; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.runtime.ProcessInstance; + +/** + * @author Thorben Lindhauer + * + */ +@Named +public class ProcessVariableBean { + + @Inject + protected ProcessInstance processInstance; + + @Inject + protected RuntimeService runtimeService; + + public String getNewValue() { + Object var = runtimeService.getVariable(processInstance.getId(), "var"); + + return var.toString() + var.toString(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/RequestScopedDelegateBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/RequestScopedDelegateBean.java new file mode 100644 index 0000000000000000000000000000000000000000..537d78a5c28c717a4f7ac61227a95b23bd2760a5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/RequestScopedDelegateBean.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi.beans; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Named; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +/** + * A {@link RequestScoped} bean + * + * @author Daniel Meyer + * + */ +@Named +@RequestScoped +public class RequestScopedDelegateBean implements JavaDelegate { + + private int invocationCounter = 0; + + @Override + public void execute(DelegateExecution execution) throws Exception { + invocationCounter++; + execution.setVariable("invocationCounter", invocationCounter); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/RetryConfig.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/RetryConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..483fe9e305ff8d56a084db6fcf6624833c3590eb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/RetryConfig.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi.beans; + +import javax.inject.Named; + +@Named +public class RetryConfig { + public RetryConfig() { + } + + public String defaultConfig() { + return "PT1M,PT2M,PT3M,PT4M,PT5M,PT6M"; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/TimerStartBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/TimerStartBean.java new file mode 100644 index 0000000000000000000000000000000000000000..43a80c41448b1e7bf3dd054daedfe65111fe7dce --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/TimerStartBean.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi.beans; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; + +/** + * @author Thorben Lindhauer + * + */ +@Named +@ApplicationScoped +public class TimerStartBean { + + public String getCycle() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.add(Calendar.SECOND, 10); + Date startTime = calendar.getTime(); + return iso8601(startTime); + } + + private String iso8601(Date date) { + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + String dateStr = dateFormat.format(date); + System.out.println("Date: " + dateStr); + return dateStr; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/VersionTagBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/VersionTagBean.java new file mode 100644 index 0000000000000000000000000000000000000000..11a92e48b552acfc67285e2e76cb1283fc6e021c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/cdi/beans/VersionTagBean.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.cdi.beans; + +import javax.inject.Named; + +@Named +public class VersionTagBean { + + public String versionTag() { + return "ver-0.1"; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleCaseExecutionListener.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleCaseExecutionListener.java new file mode 100644 index 0000000000000000000000000000000000000000..d39f74613d49ff5044ca13b89a59232ff64a8bd7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleCaseExecutionListener.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.beans; + +import javax.inject.Named; + +import org.camunda.bpm.engine.delegate.CaseExecutionListener; +import org.camunda.bpm.engine.delegate.DelegateCaseExecution; + +/** + * @author Roman Smirnov + * + */ +@Named(value = "caseExecutionListener") +public class ExampleCaseExecutionListener implements CaseExecutionListener { + + public void notify(DelegateCaseExecution caseExecution) throws Exception { + caseExecution.setVariable("listener", "listener-notified"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleCaseVariableListener.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleCaseVariableListener.java new file mode 100644 index 0000000000000000000000000000000000000000..74ba8076cb0d2db8b85892c1d3cae86236539cbc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleCaseVariableListener.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.beans; + +import org.camunda.bpm.engine.delegate.CaseVariableListener; +import org.camunda.bpm.engine.delegate.DelegateCaseVariableInstance; + +/** + * @author Thorben Lindhauer + * + */ +public class ExampleCaseVariableListener implements CaseVariableListener { + + public void notify(DelegateCaseVariableInstance variableInstance) throws Exception { + if ("variable".equals(variableInstance.getName())) { + if ("initial".equals(variableInstance.getValue())) { + variableInstance.getSourceExecution().setVariable("variable", "listener-notified-1"); + } else if ("manual-start".equals(variableInstance.getValue())) { + variableInstance.getSourceExecution().setVariable("variable", "listener-notified-2"); + }// else ignore + } else { + throw new RuntimeException("Unexpected invocation"); + } + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..97e3df3ff6740082ba1f49fcff62ab1187a17fab --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleDelegate.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.beans; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +public class ExampleDelegate implements JavaDelegate { + + private static boolean invoked = false; + + public void execute(DelegateExecution arg0) throws Exception { + invoked = true; + } + + public static boolean isInvoked() { + return invoked; + } + + public static void setInvoked(boolean invoked) { + ExampleDelegate.invoked = invoked; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleSignallableActivityBehavior.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleSignallableActivityBehavior.java new file mode 100644 index 0000000000000000000000000000000000000000..c7d0f1e5ceab6266e5198142120689321121cd66 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleSignallableActivityBehavior.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.beans; + +import org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior; +import org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution; + +/** + * @author Daniel Meyer + * + */ +public class ExampleSignallableActivityBehavior extends AbstractBpmnActivityBehavior { + + @Override + public void execute(ActivityExecution execution) throws Exception { + + // do nothing = waitstate + + } + + @Override + public void signal(ActivityExecution execution, String signalEvent, Object signalData) throws Exception { + + // leave waitstate + leave(execution); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleTaskListener.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleTaskListener.java new file mode 100644 index 0000000000000000000000000000000000000000..79438073fb86576c4c89f4beda1dbf6d16503df4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/beans/ExampleTaskListener.java @@ -0,0 +1,32 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.beans; + +import javax.inject.Named; + +import org.camunda.bpm.engine.delegate.DelegateTask; +import org.camunda.bpm.engine.delegate.TaskListener; + +@Named(value = "taskListener") +public class ExampleTaskListener implements TaskListener { + + @Override + public void notify(DelegateTask delegateTask) { + delegateTask.setVariable("listener", "listener-notified"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/deployment/RedeployCaseClassloadingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/deployment/RedeployCaseClassloadingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..dbcef97f68467f7533c3d0f1bbabcc138491df66 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/deployment/RedeployCaseClassloadingTest.java @@ -0,0 +1,109 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.deployment; + +import org.camunda.bpm.engine.runtime.VariableInstanceQuery; +import org.camunda.bpm.integrationtest.functional.classloading.beans.ExampleCaseExecutionListener; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Roman Smirnov + * + */ +@RunWith(Arquillian.class) +public class RedeployCaseClassloadingTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeplyoment() { + return initWebArchiveDeployment() + .addClass(ExampleCaseExecutionListener.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/classloading/deployment/RedeployCaseClassloadingTest.testRedeployClassloading.cmmn10.xml"); + } + + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testRedeployClassloading() { + // given + org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery().singleResult(); + + org.camunda.bpm.engine.repository.Deployment deployment2 = repositoryService + .createDeployment() + .nameFromDeployment(deployment.getId()) + .addDeploymentResources(deployment.getId()) + .deploy(); + + // when (2) + String caseInstanceId = caseService + .withCaseDefinitionByKey("case") + .create() + .getId(); + + String humanTaskId = caseService + .createCaseExecutionQuery() + .activityId("PI_HumanTask_1") + .singleResult() + .getId(); + + // then (1) + VariableInstanceQuery query = runtimeService + .createVariableInstanceQuery() + .variableName("listener") + .caseInstanceIdIn(caseInstanceId); + + Assert.assertNotNull(query.singleResult()); + Assert.assertEquals("listener-notified", query.singleResult().getValue()); + + caseService + .withCaseExecution(caseInstanceId) + .removeVariable("listener") + .execute(); + + Assert.assertEquals(0, query.count()); + + // when (2) + caseService + .withCaseExecution(humanTaskId) + .complete(); + + // then (2) + Assert.assertNotNull(query.singleResult()); + Assert.assertEquals("listener-notified", query.singleResult().getValue()); + + repositoryService.deleteDeployment(deployment2.getId(), true, true); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/deployment/RedeployProcessClassloadingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/deployment/RedeployProcessClassloadingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3faf52f61580b2ad7808b70faa75014336b88699 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/deployment/RedeployProcessClassloadingTest.java @@ -0,0 +1,76 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.deployment; + +import org.camunda.bpm.integrationtest.functional.classloading.deployment.beans.MyCustomDelegate; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Roman Smirnov + * + */ +@RunWith(Arquillian.class) +public class RedeployProcessClassloadingTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeplyoment() { + return initWebArchiveDeployment() + .addClass(MyCustomDelegate.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/classloading/deployment/RedeployProcessClassloadingTest.testRedeployClassloading.bpmn20.xml"); + } + + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testRedeployClassloading() { + // given + org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery().singleResult(); + + org.camunda.bpm.engine.repository.Deployment deployment2 = repositoryService + .createDeployment() + .nameFromDeployment(deployment.getId()) + .addDeploymentResources(deployment.getId()) + .deploy(); + + // when + String id = runtimeService.startProcessInstanceByKey("process").getId(); + + // then + Assert.assertTrue((Boolean) runtimeService.getVariable(id, "executed")); + + repositoryService.deleteDeployment(deployment2.getId(), true); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/deployment/beans/MyCustomDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/deployment/beans/MyCustomDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..04ebc85df43f5b3b720d15d1f5e72b09f79a5ef4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/deployment/beans/MyCustomDelegate.java @@ -0,0 +1,32 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.deployment.beans; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +/** + * @author smirnov + * + */ +public class MyCustomDelegate implements JavaDelegate { + + public void execute(DelegateExecution execution) throws Exception { + execution.setVariable("executed", true); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/ear/TestJavaDelegateResolution_ClientAsLibInWebModule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/ear/TestJavaDelegateResolution_ClientAsLibInWebModule.java new file mode 100644 index 0000000000000000000000000000000000000000..15d0a57ee44f37cbff8895f5b7aeaac21216c002 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/ear/TestJavaDelegateResolution_ClientAsLibInWebModule.java @@ -0,0 +1,97 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.ear; +import javax.transaction.SystemException; + +import org.camunda.bpm.integrationtest.functional.classloading.beans.ExampleDelegate; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + *

Deploys an EAR application which contains a WAR process archive, and a client application deployed as a war

+ * + *

This test ensures that when the process is started from the client, + * it is able to make the context switch to the process archvie and resolve classes from the + * process archive.

+ * + * + * @author Daniel Meyer + */ +@RunWith(Arquillian.class) +public class TestJavaDelegateResolution_ClientAsLibInWebModule extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static EnterpriseArchive createProcessArchiveDeplyoment() { + WebArchive processArchiveWar = initWebArchiveDeployment() + .addClass(ExampleDelegate.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/classloading/JavaDelegateResolutionTest.testResolveClass.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/classloading/JavaDelegateResolutionTest.testResolveClassFromJobExecutor.bpmn20.xml"); + + return ShrinkWrap.create(EnterpriseArchive.class, "test-app.ear") + .addAsModule(processArchiveWar); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveClass() { + // assert that we cannot load the delegate here: + try { + Class.forName("org.camunda.bpm.integrationtest.functional.classloading.ExampleDelegate"); + Assert.fail("CNFE expected"); + }catch (ClassNotFoundException e) { + // expected + } + + // but the process can since it performs context switch to the process archive vor execution + runtimeService.startProcessInstanceByKey("testResolveClass"); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveClassFromJobExecutor() throws InterruptedException, SystemException { + + runtimeService.startProcessInstanceByKey("testResolveClassFromJobExecutor"); + + Assert.assertEquals(1, runtimeService.createProcessInstanceQuery().count()); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(0, runtimeService.createProcessInstanceQuery().count()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/jobexecution/ClassloadingByJobPriorityTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/jobexecution/ClassloadingByJobPriorityTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f8d9bf76090084d4b35d63fc37196f0ff93fc035 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/jobexecution/ClassloadingByJobPriorityTest.java @@ -0,0 +1,93 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.jobexecution; + +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.util.List; + +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.impl.jobexecutor.JobExecutor; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/* + See https://jira.camunda.com/browse/CAM-9913 + */ +@RunWith(Arquillian.class) +public class ClassloadingByJobPriorityTest extends AbstractFoxPlatformIntegrationTest { + + protected static final BpmnModelInstance process = Bpmn.createExecutableProcess("asyncTaskProcess") + .camundaHistoryTimeToLive(180) + .startEvent() + .serviceTask() + .camundaExpression("${true}") + .camundaAsyncBefore() + .endEvent() + .done(); + + @Deployment(name= "engineWithPriorityJobAcquisition") + public static WebArchive processArchive() { + WebArchive webArchive = initWebArchiveDeployment("processApp.war", + "org/camunda/bpm/integrationtest/functional/classloading/jobexecution/engineWithAcquireJobsByPriority.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsResource(modelAsAsset(process), "ClassloadingByJobPriorityTest.testDeployProcessArchive.bpmn"); + TestContainer.addContainerSpecificResources(webArchive); + TestContainer.addContainerSpecificProcessEngineConfigurationClass(webArchive); + + return webArchive; + } + + @Test + @OperateOnDeployment("engineWithPriorityJobAcquisition") + public void testDeployProcessArchive() { + // given + ProcessEngineConfigurationImpl configuration = (ProcessEngineConfigurationImpl) processEngineService + .getProcessEngine("engineWithJobPriority") + .getProcessEngineConfiguration(); + configuration.getRuntimeService().startProcessInstanceByKey("asyncTaskProcess"); + + // when + JobExecutor jobExecutor = configuration.getJobExecutor(); + waitForJobExecutorToProcessAllJobs(jobExecutor, 12000); + + // then + List availableJobs = configuration.getManagementService().createJobQuery().noRetriesLeft().list(); + assertTrue(availableJobs.isEmpty()); + } + + protected static Asset modelAsAsset(BpmnModelInstance modelInstance) { + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + Bpmn.writeModelToStream(byteStream, modelInstance); + + byte[] bytes = byteStream.toByteArray(); + return new ByteArrayAsset(bytes); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/jobexecution/ClassloadingDuringJobExecutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/jobexecution/ClassloadingDuringJobExecutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..58c9537f2e16141f714ec8caa014cd2f9a98d936 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/jobexecution/ClassloadingDuringJobExecutionTest.java @@ -0,0 +1,90 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.jobexecution; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import java.util.List; + +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * See CAM-10258 + */ +@RunWith(Arquillian.class) +public class ClassloadingDuringJobExecutionTest extends AbstractFoxPlatformIntegrationTest { + protected static String process = + "\r\n" + + "\r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " throw new org.camunda.bpm.engine.delegate.BpmnError(\"Test error thrown\");\r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + "\r\n"; + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + TestContainer.addContainerSpecificResourcesForNonPa(deployment); + return deployment; + } + + @Test + public void shouldLoadBPMNErorClassUsedInGroovyScriptDuringJobExecution() { + // given + String deploymentId = repositoryService.createDeployment() + .addString("process.bpmn", process) + .deploy().getId(); + runtimeService.startProcessInstanceByKey("Process_1"); + + // when + waitForJobExecutorToProcessAllJobs(); + + // then + List failedJobs = managementService.createJobQuery().noRetriesLeft().list(); + assertTrue(failedJobs.size() > 0); + for (Job job : failedJobs) { + String jobExceptionStacktrace = managementService.getJobExceptionStacktrace(job.getId()); + assertFalse(jobExceptionStacktrace.contains("ClassNotFoundException")); + assertTrue(jobExceptionStacktrace.contains("Test error thrown")); + } + // clean up + repositoryService.deleteDeployment(deploymentId, true); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/DeserializableVariableTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/DeserializableVariableTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6feb20822028a5d556398fec8928ad308bc85c16 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/DeserializableVariableTest.java @@ -0,0 +1,90 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.variables; + +import org.camunda.bpm.engine.history.HistoricVariableInstance; +import org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.classloading.variables.beans.GetDeserializableVariableDelegate; +import org.camunda.bpm.integrationtest.functional.classloading.variables.beans.SerializableVariable; +import org.camunda.bpm.integrationtest.functional.classloading.variables.beans.SetVariableDelegate; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.List; + +/** + *

Ensures that process variables can be deserialized on a + * process instance restart, when running on an appication server

+ * + * @author Nikola Koevski + */ +@RunWith(Arquillian.class) +public class DeserializableVariableTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeplyoment() { + return initWebArchiveDeployment() + .addClass(GetDeserializableVariableDelegate.class) + .addClass(SetVariableDelegate.class) + .addClass(SerializableVariable.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/classloading/DeserializableVariableTest.testVariableDeserializationOnProcessApplicationRestart.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testVariableDeserializationOnProcessApplicationRestart() { + // given + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testDeserializeVariable"); + + // when + Assert.assertNull(runtimeService.createProcessInstanceQuery().processInstanceId(pi.getId()).singleResult()); + runtimeService.restartProcessInstances(pi.getProcessDefinitionId()) + .startAfterActivity("servicetask1") + .processInstanceIds(pi.getId()) + .execute(); + + // then + + // Since the variable retrieval is done outside the Process Application Context as well, + // custom object deserialization is disabled and a null check is performed + List variableInstances = historyService.createHistoricVariableInstanceQuery().disableCustomObjectDeserialization().list(); + for (HistoricVariableInstance variable : variableInstances) { + if (variable.getProcessInstanceId() != pi.getId() && variable instanceof HistoricVariableInstanceEntity) { + Assert.assertNotNull(((HistoricVariableInstanceEntity) variable).getByteArrayValue()); + } + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/SerializableVariableTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/SerializableVariableTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e56eb8932d7535b8fdba615e73515eb691ca3a1b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/SerializableVariableTest.java @@ -0,0 +1,59 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.variables; +import org.camunda.bpm.integrationtest.functional.classloading.variables.beans.GetVariableDelegate; +import org.camunda.bpm.integrationtest.functional.classloading.variables.beans.SerializableVariable; +import org.camunda.bpm.integrationtest.functional.classloading.variables.beans.SetVariableDelegate; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + *

Ensures that serializable process variables can be used in + * combination with the shared process engine

+ * + * @author Daniel Meyer + */ +@RunWith(Arquillian.class) +public class SerializableVariableTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeplyoment() { + return initWebArchiveDeployment() + .addClass(GetVariableDelegate.class) + .addClass(SetVariableDelegate.class) + .addClass(SerializableVariable.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/classloading/SerializableVariableTest.testResolveVariable.bpmn20.xml"); + } + + @Test + public void testResolveClass() { + + String pid = runtimeService.startProcessInstanceByKey("testResolveVariable").getId(); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertNull(runtimeService.createProcessInstanceQuery().processInstanceId(pid).singleResult()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/beans/GetDeserializableVariableDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/beans/GetDeserializableVariableDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..b1f7012fcb712654f9a267abeef05501dc1d7491 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/beans/GetDeserializableVariableDelegate.java @@ -0,0 +1,28 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.variables.beans; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +public class GetDeserializableVariableDelegate implements JavaDelegate{ + + @Override + public void execute(DelegateExecution execution) throws Exception { + SerializableVariable variable = (SerializableVariable) execution.getVariable("var1"); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/beans/GetVariableDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/beans/GetVariableDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..cf6c850e68d1689e2b98190abeda01939f791375 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/beans/GetVariableDelegate.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.variables.beans; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.junit.Assert; + +/** + * @author Daniel Meyer + * + */ +public class GetVariableDelegate implements JavaDelegate { + + public void execute(DelegateExecution execution) throws Exception { + + SerializableVariable variable = (SerializableVariable) execution.getVariable("var1"); + + Assert.assertNotNull(variable); + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/beans/SerializableVariable.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/beans/SerializableVariable.java new file mode 100644 index 0000000000000000000000000000000000000000..cb693ade32a363e6713d3f9969372df6964d41a2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/beans/SerializableVariable.java @@ -0,0 +1,42 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.variables.beans; + +import java.io.Serializable; + +/** + * A {@link Serializable} variable. + * + * @author Daniel Meyer + * + */ +public class SerializableVariable implements Serializable { + + private static final long serialVersionUID = 1L; + + private String value; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/beans/SetVariableDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/beans/SetVariableDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..8b9fb696c5e34dc0731fb5aa179c07d89b367f64 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/variables/beans/SetVariableDelegate.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.variables.beans; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +/** + * @author Daniel Meyer + * + */ +public class SetVariableDelegate implements JavaDelegate { + + public void execute(DelegateExecution execution) throws Exception { + + SerializableVariable serializableVariable = new SerializableVariable(); + serializableVariable.setValue("camunda BPM"); + + execution.setVariable("var1", serializableVariable); + + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/CaseExecutionListenerResolutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/CaseExecutionListenerResolutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3b5c67ff99231afd7bb0cfd52fc5279d5fbfe0d0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/CaseExecutionListenerResolutionTest.java @@ -0,0 +1,104 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.war; + +import org.camunda.bpm.engine.runtime.VariableInstanceQuery; +import org.camunda.bpm.integrationtest.functional.classloading.beans.ExampleCaseExecutionListener; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Roman Smirnov + * + */ +@RunWith(Arquillian.class) +public class CaseExecutionListenerResolutionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeplyoment() { + return initWebArchiveDeployment() + .addClass(ExampleCaseExecutionListener.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/classloading/CaseExecutionListenerResolutionTest.cmmn"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveCaseExecutionListenerClass() { + // assert that we cannot load the delegate here: + try { + Class.forName("org.camunda.bpm.integrationtest.functional.classloading.beans.ExampleCaseExecutionListener"); + Assert.fail("CNFE expected"); + }catch (ClassNotFoundException e) { + // expected + } + + String caseInstanceId = caseService + .withCaseDefinitionByKey("case") + .create() + .getId(); + + String humanTaskId = caseService + .createCaseExecutionQuery() + .activityId("PI_HumanTask_1") + .singleResult() + .getId(); + + VariableInstanceQuery query = runtimeService + .createVariableInstanceQuery() + .variableName("listener") + .caseInstanceIdIn(caseInstanceId); + + Assert.assertNotNull(query.singleResult()); + Assert.assertEquals("listener-notified", query.singleResult().getValue()); + + caseService + .withCaseExecution(caseInstanceId) + .removeVariable("listener") + .execute(); + + Assert.assertEquals(0, query.count()); + + // the delegate expression listener should execute successfully + caseService + .withCaseExecution(humanTaskId) + .complete(); + + Assert.assertNotNull(query.singleResult()); + Assert.assertEquals("listener-notified", query.singleResult().getValue()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/CaseVariableListenerResolutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/CaseVariableListenerResolutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..17a39319764c580780d6752564ab7578d826bc9b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/CaseVariableListenerResolutionTest.java @@ -0,0 +1,103 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.war; + +import org.camunda.bpm.engine.runtime.VariableInstanceQuery; +import org.camunda.bpm.integrationtest.functional.classloading.beans.ExampleCaseVariableListener; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Roman Smirnov + * + */ +@RunWith(Arquillian.class) +public class CaseVariableListenerResolutionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeplyoment() { + return initWebArchiveDeployment() + .addClass(ExampleCaseVariableListener.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/classloading/CaseVariableListenerResolutionTest.cmmn"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveCaseExecutionListenerClass() { + // assert that we cannot load the delegate here: + try { + Class.forName("org.camunda.bpm.integrationtest.functional.classloading.beans.ExampleCaseVariableListener"); + Assert.fail("CNFE expected"); + }catch (ClassNotFoundException e) { + // expected + } + + String caseInstanceId = caseService + .withCaseDefinitionByKey("case") + .create() + .getId(); + + String humanTaskId = caseService + .createCaseExecutionQuery() + .activityId("PI_HumanTask_1") + .singleResult() + .getId(); + + // the listener should execute successfully + caseService + .withCaseExecution(humanTaskId) + .setVariable("variable", "initial") + .execute(); + + VariableInstanceQuery query = runtimeService + .createVariableInstanceQuery() + .variableName("variable") + .caseInstanceIdIn(caseInstanceId); + + Assert.assertNotNull(query.singleResult()); + Assert.assertEquals("listener-notified-1", query.singleResult().getValue()); + + caseService + .withCaseExecution(humanTaskId) + .setVariable("variable", "manual-start") + .manualStart(); + + Assert.assertNotNull(query.singleResult()); + Assert.assertEquals("listener-notified-2", query.singleResult().getValue()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/JavaDelegateResolutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/JavaDelegateResolutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..26d20d50584f212af9c179c707d76dabdbcf82e0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/JavaDelegateResolutionTest.java @@ -0,0 +1,93 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.war; + +import org.camunda.bpm.integrationtest.functional.classloading.beans.ExampleDelegate; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + *

Deploys two different WAR applications, a process archive and a client application.

+ * + *

This test ensures that when the process is started from the client, + * it is able to make the context switch to the process archvie and resolve classes from the + * process archive.

+ * + * + * @author Daniel Meyer + */ +@RunWith(Arquillian.class) +public class JavaDelegateResolutionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeplyoment() { + return initWebArchiveDeployment() + .addClass(ExampleDelegate.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/classloading/JavaDelegateResolutionTest.testResolveClass.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/classloading/JavaDelegateResolutionTest.testResolveClassFromJobExecutor.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveClass() { + // assert that we cannot load the delegate here: + try { + Class.forName("org.camunda.bpm.integrationtest.functional.classloading.ExampleDelegate"); + Assert.fail("CNFE expected"); + }catch (ClassNotFoundException e) { + // expected + } + + // but the process can since it performs context switch to the process archive for execution + runtimeService.startProcessInstanceByKey("testResolveClass"); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveClassFromJobExecutor() throws InterruptedException { + + runtimeService.startProcessInstanceByKey("testResolveClassFromJobExecutor"); + + Assert.assertEquals(1, runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveClassFromJobExecutor").count()); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveClassFromJobExecutor").count()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/SignallableActivityBehaviorResolutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/SignallableActivityBehaviorResolutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9e48194d8b1f9933b21b2e629d2a710200e7761c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/SignallableActivityBehaviorResolutionTest.java @@ -0,0 +1,97 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.war; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.classloading.beans.ExampleSignallableActivityBehavior; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class SignallableActivityBehaviorResolutionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeplyoment() { + return initWebArchiveDeployment() + .addClass(ExampleSignallableActivityBehavior.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/classloading/SignallableActivityBehaviorResolutionTest.testResolveClass.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/classloading/SignallableActivityBehaviorResolutionTest.testResolveClassFromJobExecutor.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveClass() { + // assert that we cannot load the delegate here: + try { + Class.forName("org.camunda.bpm.integrationtest.functional.classloading.beans.ExampleSignallableActivityBehavior"); + Assert.fail("CNFE expected"); + }catch (ClassNotFoundException e) { + // expected + } + + // but the process can since it performs context switch to the process archive for execution + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testResolveClass"); + + runtimeService.signal(processInstance.getId()); + + } + + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveClassFromJobExecutor() throws InterruptedException { + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testResolveClassFromJobExecutor"); + + Assert.assertEquals(1, runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).count()); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(1, runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).count()); + + runtimeService.signal(processInstance.getId()); + + Assert.assertEquals(0, runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).count()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/TaskListenerResolutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/TaskListenerResolutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..286dd08da0a59bc688cd672d31586a231f8a9629 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/classloading/war/TaskListenerResolutionTest.java @@ -0,0 +1,95 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.classloading.war; + +import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.functional.classloading.beans.ExampleTaskListener; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class TaskListenerResolutionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeplyoment() { + return initWebArchiveDeployment() + .addClass(ExampleTaskListener.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/classloading/TaskListenerResolutionTest.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveClassOnTaskComplete() { + // assert that we cannot load the delegate here: + try { + Class.forName("org.camunda.bpm.integrationtest.functional.classloading.beans.ExampleTaskListener"); + Assert.fail("CNFE expected"); + }catch (ClassNotFoundException e) { + // expected + } + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testTaskListenerProcess"); + + // the listener should execute successfully + Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); + taskService.setAssignee(task.getId(), "john doe"); + + Execution execution = runtimeService.createExecutionQuery().processInstanceId(pi.getId()).singleResult(); + Assert.assertNotNull(runtimeService.getVariable(execution.getId(), "listener")); + runtimeService.removeVariable(execution.getId(), "listener"); + + taskService.complete(task.getId()); + + Assert.assertNotNull(runtimeService.getVariable(execution.getId(), "listener")); + + // the delegate expression listener should execute successfully + runtimeService.removeVariable(execution.getId(), "listener"); + + task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); + + taskService.setAssignee(task.getId(), "john doe"); + Assert.assertNotNull(runtimeService.getVariable(execution.getId(), "listener")); + runtimeService.removeVariable(execution.getId(), "listener"); + + taskService.complete(task.getId()); + + Assert.assertNotNull(runtimeService.getVariable(execution.getId(), "listener")); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/condition/ConditionalStartEventTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/condition/ConditionalStartEventTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6a3635418aa3a0d7a36da6f375481291f546e694 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/condition/ConditionalStartEventTest.java @@ -0,0 +1,66 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.condition; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.List; + +import org.camunda.bpm.engine.impl.event.EventType; +import org.camunda.bpm.engine.runtime.EventSubscription; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.runtime.VariableInstance; +import org.camunda.bpm.integrationtest.functional.condition.bean.ConditionalBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class ConditionalStartEventTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeployment() { + return initWebArchiveDeployment() + .addClass(ConditionalBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/condition/ConditionalStartEventTest.bpmn20.xml"); + } + + @Test + public void testStartInstanceWithBeanCondition() { + List eventSubscriptions = runtimeService.createEventSubscriptionQuery().list(); + + assertEquals(1, eventSubscriptions.size()); + assertEquals(EventType.CONDITONAL.name(), eventSubscriptions.get(0).getEventType()); + + List instances = runtimeService + .createConditionEvaluation() + .setVariable("foo", 1) + .evaluateStartConditions(); + + assertEquals(1, instances.size()); + + assertNotNull(runtimeService.createProcessInstanceQuery().processDefinitionKey("conditionalEventProcess").singleResult()); + + VariableInstance vars = runtimeService.createVariableInstanceQuery().singleResult(); + assertEquals(vars.getProcessInstanceId(), instances.get(0).getId()); + assertEquals(1, vars.getValue()); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/condition/bean/ConditionalBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/condition/bean/ConditionalBean.java new file mode 100644 index 0000000000000000000000000000000000000000..dc29f0eb73d45d420be4d9d897f21d946a54f093 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/condition/bean/ConditionalBean.java @@ -0,0 +1,28 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.condition.bean; + +import javax.inject.Named; + +@Named +public class ConditionalBean { + + public boolean isApplicable() { + return true; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/PaConnectSupportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/PaConnectSupportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ba6e0f045405f07fe5c22751dbee65f6b3ebda82 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/PaConnectSupportTest.java @@ -0,0 +1,73 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.connect; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.connect.Connectors; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + *

Smoketest Make sure camunda connect can be used in a process application

+ * + * @author Daniel Meyer + */ +@RunWith(Arquillian.class) +public class PaConnectSupportTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createDeployment() { + return initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/functional/connect/PaConnectSupportTest.connectorServiceTask.bpmn20.xml") + .addClass(TestConnector.class) + .addClass(TestConnectorRequest.class) + .addClass(TestConnectorResponse.class) + .addClass(TestConnectors.class); + } + + @Test + public void httpConnectorShouldBeAvailable() { + assertNotNull(Connectors.http()); + } + + @Test + public void soapConnectorShouldBeAvailable() { + assertNotNull(Connectors.soap()); + } + + @Test + public void connectorServiceTask() { + TestConnector connector = new TestConnector(); + TestConnectors.registerConnector(connector); + + runtimeService.startProcessInstanceByKey("testProcess"); + Task task = taskService.createTaskQuery().singleResult(); + assertNotNull(task); + String payload = (String) taskService.getVariable(task.getId(), "payload"); + assertEquals("Hello world!", payload); + + TestConnectors.unregisterConnector(connector.getId()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/TestConnector.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/TestConnector.java new file mode 100644 index 0000000000000000000000000000000000000000..5b0a685b0f474c09414091614ac0158da3633dde --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/TestConnector.java @@ -0,0 +1,60 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.connect; + +import java.util.Collection; +import java.util.List; + +import org.camunda.connect.spi.Connector; +import org.camunda.connect.spi.ConnectorRequestInterceptor; +import org.camunda.connect.spi.ConnectorResponse; + +public class TestConnector implements Connector { + + public static final String ID = "pa-test-connector"; + + public String getId() { + return ID; + } + + public TestConnectorRequest createRequest() { + return new TestConnectorRequest(); + } + + public List getRequestInterceptors() { + return null; + } + + public void setRequestInterceptors(List list) { + // ignore + } + + public Connector addRequestInterceptor(ConnectorRequestInterceptor connectorRequestInterceptor) { + // ignore + return this; + } + + public Connector addRequestInterceptors(Collection collection) { + // ignore + return this; + } + + public ConnectorResponse execute(TestConnectorRequest testConnectorRequest) { + return testConnectorRequest.execute(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/TestConnectorRequest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/TestConnectorRequest.java new file mode 100644 index 0000000000000000000000000000000000000000..1d69a8d7f768fe004dc8ae7313054107c6f2dec4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/TestConnectorRequest.java @@ -0,0 +1,56 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.connect; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.connect.spi.ConnectorRequest; + +public class TestConnectorRequest implements ConnectorRequest { + + protected Map requestParameters; + + public void setRequestParameters(Map parameters) { + requestParameters = parameters; + } + + public void setRequestParameter(String name, Object value) { + if (requestParameters == null) { + requestParameters = new HashMap(); + } + requestParameters.put(name, value); + } + + public Map getRequestParameters() { + return requestParameters; + } + + @SuppressWarnings("unchecked") + public V getRequestParameter(String name) { + return (V) requestParameters.get(name); + } + + public TestConnectorResponse execute() { + TestConnectorResponse response = new TestConnectorResponse(); + if (requestParameters != null) { + response.setResponseParameters(requestParameters); + } + return response; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/TestConnectorResponse.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/TestConnectorResponse.java new file mode 100644 index 0000000000000000000000000000000000000000..cf25be0e3bc350cdedcc4bd998e6bf0f64f59a4c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/TestConnectorResponse.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.connect; + +import java.util.Map; + +import org.camunda.connect.spi.ConnectorResponse; + +public class TestConnectorResponse implements ConnectorResponse { + + protected Map responseParameters; + + public Map getResponseParameters() { + return responseParameters; + } + + @SuppressWarnings("unchecked") + public V getResponseParameter(String name) { + return (V) responseParameters.get(name); + } + + public void setResponseParameters(Map responseParameters) { + this.responseParameters = responseParameters; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/TestConnectors.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/TestConnectors.java new file mode 100644 index 0000000000000000000000000000000000000000..c62e12595357f856ca0db9b7159147ee03b365cc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/connect/TestConnectors.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.connect; + +import org.camunda.connect.Connectors; +import org.camunda.connect.spi.Connector; + +/** + * @author Thorben Lindhauer + * + */ +public class TestConnectors extends Connectors { + + public static void registerConnector(Connector connector) { + Connectors.registerConnector(connector); + } + + public static void unregisterConnector(String connectorId) { + Connectors.unregisterConnector(connectorId); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d19ccd7f41b49d3f4882a2133b3c3a8c4a891c07 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.java @@ -0,0 +1,336 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.context; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import javax.enterprise.inject.spi.Bean; +import javax.enterprise.inject.spi.BeanManager; +import javax.inject.Inject; + +import org.junit.Assert; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.context.beans.CalledProcessDelegate; +import org.camunda.bpm.integrationtest.functional.context.beans.DelegateAfter; +import org.camunda.bpm.integrationtest.functional.context.beans.DelegateBefore; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + *

This test ensures that if a call activity calls a process + * from a different process archive than the calling process, + * we perform the appropriate context switch

+ * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class CallActivityContextSwitchTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name="mainDeployment") + public static WebArchive createProcessArchiveDeplyoment() { + return initWebArchiveDeployment("mainDeployment.war") + .addClass(DelegateBefore.class) + .addClass(DelegateAfter.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.mainProcessSync.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.mainProcessSyncNoWait.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.mainProcessASync.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.mainProcessASyncBefore.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.mainProcessASyncAfter.bpmn20.xml"); + } + + @Deployment(name="calledDeployment") + public static WebArchive createSecondProcessArchiveDeployment() { + return initWebArchiveDeployment("calledDeployment.war") + .addClass(CalledProcessDelegate.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.calledProcessSync.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.calledProcessSyncNoWait.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.calledProcessASync.bpmn20.xml"); + } + + @Inject + private BeanManager beanManager; + + @Test + @OperateOnDeployment("mainDeployment") + public void testNoWaitState() { + + // this test makes sure the delegate invoked by the called process can be resolved (context switch necessary). + + // we cannot load the class + try { + new CalledProcessDelegate(); + Assert.fail("exception expected"); + }catch (NoClassDefFoundError e) { + // expected + } + + // our bean manager does not know this bean + Set> beans = beanManager.getBeans("calledProcessDelegate"); + Assert.assertEquals(0, beans.size()); + + // but when we execute the process, we perform the context switch to the corresponding deployment + // and there the class can be resolved and the bean is known. + Map processVariables = new HashMap(); + processVariables.put("calledElement", "calledProcessSyncNoWait"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("mainProcessSyncNoWait", processVariables); + + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(pi.getId()).singleResult()); + } + + @Test + @OperateOnDeployment("mainDeployment") + public void testMainSyncCalledSync() { + + Map processVariables = new HashMap(); + processVariables.put("calledElement", "calledProcessSync"); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("mainProcessSync", processVariables); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateBefore.class.getName())); + + ProcessInstance calledPi = runtimeService.createProcessInstanceQuery() + .processDefinitionKey("calledProcessSync") + .singleResult(); + Assert.assertEquals(true, runtimeService.getVariable(calledPi.getId(), "calledDelegate")); + + taskService.complete(taskService.createTaskQuery().processInstanceId(calledPi.getId()).singleResult().getId()); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateAfter.class.getName())); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(pi.getId()).singleResult()); + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(calledPi.getId()).singleResult()); + } + + @Test + @OperateOnDeployment("mainDeployment") + public void testMainASyncCalledSync() { + + Map processVariables = new HashMap(); + processVariables.put("calledElement", "calledProcessSync"); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("mainProcessASync", processVariables); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateBefore.class.getName())); + + waitForJobExecutorToProcessAllJobs(); + + ProcessInstance calledPi = runtimeService.createProcessInstanceQuery() + .processDefinitionKey("calledProcessSync") + .singleResult(); + Assert.assertEquals(true, runtimeService.getVariable(calledPi.getId(), "calledDelegate")); + + taskService.complete(taskService.createTaskQuery().processInstanceId(calledPi.getId()).singleResult().getId()); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateAfter.class.getName())); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(pi.getId()).singleResult()); + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(calledPi.getId()).singleResult()); + } + + @Test + @OperateOnDeployment("mainDeployment") + public void testMainASyncBeforeCalledSync() { + + Map processVariables = new HashMap(); + processVariables.put("calledElement", "calledProcessSync"); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("mainProcessASyncBefore", processVariables); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateBefore.class.getName())); + + ProcessInstance calledPi = runtimeService.createProcessInstanceQuery() + .processDefinitionKey("calledProcessSync") + .singleResult(); + Assert.assertEquals(true, runtimeService.getVariable(calledPi.getId(), "calledDelegate")); + + taskService.complete(taskService.createTaskQuery().processInstanceId(calledPi.getId()).singleResult().getId()); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateAfter.class.getName())); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(pi.getId()).singleResult()); + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(calledPi.getId()).singleResult()); + } + + @Test + @OperateOnDeployment("mainDeployment") + public void testMainASyncAfterCalledSync() { + + Map processVariables = new HashMap(); + processVariables.put("calledElement", "calledProcessSync"); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("mainProcessASyncAfter", processVariables); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateBefore.class.getName())); + + ProcessInstance calledPi = runtimeService.createProcessInstanceQuery() + .processDefinitionKey("calledProcessSync") + .singleResult(); + Assert.assertEquals(true, runtimeService.getVariable(calledPi.getId(), "calledDelegate")); + + taskService.complete(taskService.createTaskQuery().processInstanceId(calledPi.getId()).singleResult().getId()); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateAfter.class.getName())); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(pi.getId()).singleResult()); + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(calledPi.getId()).singleResult()); + } + + // the same in main process but called process async + + @Test + @OperateOnDeployment("mainDeployment") + public void testMainSyncCalledASync() { + + Map processVariables = new HashMap(); + processVariables.put("calledElement", "calledProcessASync"); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("mainProcessSync", processVariables); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateBefore.class.getName())); + + ProcessInstance calledPi = runtimeService.createProcessInstanceQuery() + .processDefinitionKey("calledProcessASync") + .singleResult(); + + Assert.assertNotNull(calledPi); + Assert.assertNull(runtimeService.getVariable(calledPi.getId(), "calledDelegate")); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(true, runtimeService.getVariable(calledPi.getId(), "calledDelegate")); + + taskService.complete(taskService.createTaskQuery().processInstanceId(calledPi.getId()).singleResult().getId()); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateAfter.class.getName())); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(pi.getId()).singleResult()); + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(calledPi.getId()).singleResult()); + } + + @Test + @OperateOnDeployment("mainDeployment") + public void testMainASyncCalledASync() { + + Map processVariables = new HashMap(); + processVariables.put("calledElement", "calledProcessASync"); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("mainProcessASync", processVariables); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateBefore.class.getName())); + + waitForJobExecutorToProcessAllJobs(); + + ProcessInstance calledPi = runtimeService.createProcessInstanceQuery() + .processDefinitionKey("calledProcessASync") + .singleResult(); + Assert.assertEquals(true, runtimeService.getVariable(calledPi.getId(), "calledDelegate")); + + taskService.complete(taskService.createTaskQuery().processInstanceId(calledPi.getId()).singleResult().getId()); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateAfter.class.getName())); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(pi.getId()).singleResult()); + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(calledPi.getId()).singleResult()); + } + + @Test + @OperateOnDeployment("mainDeployment") + public void testMainASyncBeforeCalledASync() { + + Map processVariables = new HashMap(); + processVariables.put("calledElement", "calledProcessASync"); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("mainProcessASyncBefore", processVariables); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateBefore.class.getName())); + + ProcessInstance calledPi = runtimeService.createProcessInstanceQuery() + .processDefinitionKey("calledProcessASync") + .singleResult(); + Assert.assertEquals(true, runtimeService.getVariable(calledPi.getId(), "calledDelegate")); + + taskService.complete(taskService.createTaskQuery().processInstanceId(calledPi.getId()).singleResult().getId()); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateAfter.class.getName())); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(pi.getId()).singleResult()); + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(calledPi.getId()).singleResult()); + } + + @Test + @OperateOnDeployment("mainDeployment") + public void testMainASyncAfterCalledASync() { + + Map processVariables = new HashMap(); + processVariables.put("calledElement", "calledProcessASync"); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("mainProcessASyncAfter", processVariables); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateBefore.class.getName())); + + waitForJobExecutorToProcessAllJobs(); + + ProcessInstance calledPi = runtimeService.createProcessInstanceQuery() + .processDefinitionKey("calledProcessASync") + .singleResult(); + Assert.assertEquals(true, runtimeService.getVariable(calledPi.getId(), "calledDelegate")); + + taskService.complete(taskService.createTaskQuery().processInstanceId(calledPi.getId()).singleResult().getId()); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), DelegateAfter.class.getName())); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(pi.getId()).singleResult()); + Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(calledPi.getId()).singleResult()); + } + + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/InvocationContextTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/InvocationContextTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c709ab37f7bf32e1e262d6416ef1ee9310a36dbd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/InvocationContextTest.java @@ -0,0 +1,136 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.context; + +import java.util.Date; +import org.camunda.bpm.application.InvocationContext; +import org.camunda.bpm.engine.impl.util.ClockUtil; +import org.camunda.bpm.engine.runtime.EventSubscription; +import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.context.beans.NoOpJavaDelegate; +import org.camunda.bpm.integrationtest.functional.context.beans.SignalableTask; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; + +/** + * Checks if the process application is invoked with an invocation context. + */ +@RunWith(Arquillian.class) +public class InvocationContextTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name = "app") + public static WebArchive createDeployment() { + return ShrinkWrap.create(WebArchive.class, "app.war") + .addAsResource("META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(ProcessApplicationWithInvocationContext.class) + .addClass(NoOpJavaDelegate.class) + .addClass(SignalableTask.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/context/InvocationContextTest-timer.bpmn") + .addAsResource("org/camunda/bpm/integrationtest/functional/context/InvocationContextTest-message.bpmn") + .addAsResource("org/camunda/bpm/integrationtest/functional/context/InvocationContextTest-signalTask.bpmn"); + } + + @After + public void cleanUp() { + ClockUtil.reset(); + } + + @Test + @OperateOnDeployment("app") + public void testInvokeProcessApplicationWithContextOnStart() { + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("messageProcess"); + + InvocationContext invocationContext = ProcessApplicationWithInvocationContext.getInvocationContext(); + assertThat(invocationContext, is(notNullValue())); + assertThat(invocationContext.getExecution(), is(notNullValue())); + assertThat(invocationContext.getExecution().getId(), is(pi.getId())); + } + + @Test + @OperateOnDeployment("app") + public void testInvokeProcessApplicationWithContextOnAsyncExecution() { + + runtimeService.startProcessInstanceByKey("timerProcess"); + ProcessApplicationWithInvocationContext.clearInvocationContext(); + + Job timer = managementService.createJobQuery().timers().singleResult(); + assertThat(timer, is(notNullValue())); + + long dueDate = timer.getDuedate().getTime(); + Date afterDueDate = new Date(dueDate + 1000 * 60); + + ClockUtil.setCurrentTime(afterDueDate); + waitForJobExecutorToProcessAllJobs(); + + InvocationContext invocationContext = ProcessApplicationWithInvocationContext.getInvocationContext(); + assertThat(invocationContext, is(notNullValue())); + assertThat(invocationContext.getExecution(), is(notNullValue())); + assertThat(invocationContext.getExecution().getId(), is(timer.getExecutionId())); + } + + @Test + @OperateOnDeployment("app") + public void testInvokeProcessApplicationWithContextOnMessageReceived() { + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("messageProcess"); + ProcessApplicationWithInvocationContext.clearInvocationContext(); + + EventSubscription messageSubscription = runtimeService.createEventSubscriptionQuery().eventType("message").processInstanceId(processInstance.getId()).singleResult(); + assertThat(messageSubscription, is(notNullValue())); + + runtimeService.messageEventReceived(messageSubscription.getEventName(), messageSubscription.getExecutionId()); + + InvocationContext invocationContext = ProcessApplicationWithInvocationContext.getInvocationContext(); + assertThat(invocationContext, is(notNullValue())); + assertThat(invocationContext.getExecution(), is(notNullValue())); + assertThat(invocationContext.getExecution().getId(), is(messageSubscription.getExecutionId())); + } + + @Test + @OperateOnDeployment("app") + public void testInvokeProcessApplicationWithContextOnSignalTask() { + + runtimeService.startProcessInstanceByKey("signalableProcess"); + ProcessApplicationWithInvocationContext.clearInvocationContext(); + + Execution execution = runtimeService.createExecutionQuery().activityId("waitingTask").singleResult(); + assertThat(execution, is(notNullValue())); + + runtimeService.signal(execution.getId()); + + InvocationContext invocationContext = ProcessApplicationWithInvocationContext.getInvocationContext(); + assertThat(invocationContext, is(notNullValue())); + assertThat(invocationContext.getExecution(), is(notNullValue())); + assertThat(invocationContext.getExecution().getId(), is(execution.getId())); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/ProcessApplicationWithInvocationContext.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/ProcessApplicationWithInvocationContext.java new file mode 100644 index 0000000000000000000000000000000000000000..ec3f31dd4b130723172ad55bec59bed2ce7d8bc8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/ProcessApplicationWithInvocationContext.java @@ -0,0 +1,53 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.context; + +import java.util.concurrent.Callable; +import org.camunda.bpm.application.InvocationContext; +import org.camunda.bpm.application.ProcessApplication; +import org.camunda.bpm.application.ProcessApplicationExecutionException; + +@ProcessApplication("app") +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class ProcessApplicationWithInvocationContext extends org.camunda.bpm.application.impl.ServletProcessApplication { + + private static InvocationContext invocationContext = null; + + @Override + public T execute(Callable callable, InvocationContext invocationContext) throws ProcessApplicationExecutionException { + synchronized (ProcessApplicationWithInvocationContext.class) { + ProcessApplicationWithInvocationContext.invocationContext = invocationContext; + } + + return execute(callable); + } + + public synchronized static InvocationContext getInvocationContext() { + return ProcessApplicationWithInvocationContext.invocationContext; + } + + public synchronized static void clearInvocationContext() { + ProcessApplicationWithInvocationContext.invocationContext = null; + } + + @Override + public void undeploy() { + clearInvocationContext(); + super.undeploy(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/SetVariablesMigrationContextSwitchTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/SetVariablesMigrationContextSwitchTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a181de6b9baf1a570a96472ca01443a6deaeb293 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/SetVariablesMigrationContextSwitchTest.java @@ -0,0 +1,175 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.context; + +import org.camunda.bpm.engine.ProcessEngineException; +import org.camunda.bpm.engine.migration.MigrationPlan; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.integrationtest.functional.context.classes.MyPojo; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.ByteArrayOutputStream; +import java.util.Collections; +import java.util.List; + +import static org.junit.Assert.fail; + +@RunWith(Arquillian.class) +public class SetVariablesMigrationContextSwitchTest extends AbstractFoxPlatformIntegrationTest { + + public static BpmnModelInstance oneTaskProcess(String key) { + return Bpmn.createExecutableProcess(key) + .camundaHistoryTimeToLive(180) + .startEvent() + .userTask("userTask") + .endEvent() + .done(); + } + + @Deployment(name = "sourceDeployment") + public static WebArchive createSourceDeployment() { + return initWebArchiveDeployment("sourceDeployment.war") + .addAsResource(modelAsAsset(oneTaskProcess("sourceOneTaskProcess")), "oneTaskProcess.bpmn20.xml"); + } + + @Deployment(name = "targetDeployment") + public static WebArchive createTargetDeployment() { + return initWebArchiveDeployment("targetDeployment.war") + .addClass(MyPojo.class) + .addAsResource(modelAsAsset(oneTaskProcess("targetOneTaskProcess")), "oneTaskProcess.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + + } + + @Test + @OperateOnDeployment("clientDeployment") + public void shouldDeserializeObjectVariable_Async() { + // given + ProcessDefinition sourceDefinition = repositoryService + .createProcessDefinitionQuery() + .processDefinitionKey("sourceOneTaskProcess") + .singleResult(); + + ProcessDefinition targetDefinition = repositoryService + .createProcessDefinitionQuery() + .processDefinitionKey("targetOneTaskProcess") + .singleResult(); + + String pi = runtimeService.startProcessInstanceById(sourceDefinition.getId()).getId(); + + MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()) + .mapEqualActivities() + .setVariables(Variables.putValue("foo", + Variables.serializedObjectValue() + .objectTypeName("org.camunda.bpm.integrationtest.functional.context.classes.MyPojo") + .serializedValue("{\"name\": \"myName\", \"prio\": 5}") + .serializationDataFormat("application/json") + .create())) + .build(); + + runtimeService.newMigration(migrationPlan) + .processInstanceIds(Collections.singletonList(pi)) + .executeAsync(); + + // execute seed jobs + List jobs = managementService.createJobQuery().list(); + for (Job job : jobs) { + managementService.executeJob(job.getId()); + } + + // when: execute remaining batch jobs + jobs = managementService.createJobQuery().list(); + for (Job job : jobs) { + try { + managementService.executeJob(job.getId()); + } catch (ProcessEngineException ex) { + fail("No exception expected: " + ex.getMessage()); + } + } + + // then + Assert.assertNotNull(runtimeService.getVariableTyped(pi, "foo", false)); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void shouldDeserializeObjectVariable_Sync() { + // given + ProcessDefinition sourceDefinition = repositoryService + .createProcessDefinitionQuery() + .processDefinitionKey("sourceOneTaskProcess") + .singleResult(); + + ProcessDefinition targetDefinition = repositoryService + .createProcessDefinitionQuery() + .processDefinitionKey("targetOneTaskProcess") + .singleResult(); + + String pi = runtimeService.startProcessInstanceById(sourceDefinition.getId()).getId(); + + MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()) + .mapEqualActivities() + .setVariables(Variables.putValue("foo", + Variables.serializedObjectValue() + .objectTypeName("org.camunda.bpm.integrationtest.functional.context.classes.MyPojo") + .serializedValue("{\"name\": \"myName\", \"prio\": 5}") + .serializationDataFormat("application/json") + .create())) + .build(); + + // when + runtimeService.newMigration(migrationPlan) + .processInstanceIds(Collections.singletonList(pi)) + .execute(); + + // then + Assert.assertNotNull(runtimeService.getVariableTyped(pi, "foo", false)); + } + + protected static Asset modelAsAsset(BpmnModelInstance modelInstance) { + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + Bpmn.writeModelToStream(byteStream, modelInstance); + + byte[] bytes = byteStream.toByteArray(); + return new ByteArrayAsset(bytes); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/CalledProcessDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/CalledProcessDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..a00246c0e3c3b792fd285646b1439693f5426960 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/CalledProcessDelegate.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.context.beans; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.camunda.bpm.engine.cdi.BusinessProcess; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +/** + * + * @author Daniel Meyer + * + */ +@Named +public class CalledProcessDelegate implements JavaDelegate { + + @Inject + private BusinessProcess businessProcess; + + public void execute(DelegateExecution execution) throws Exception { + businessProcess.setVariable("calledDelegate", true); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/DelegateAfter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/DelegateAfter.java new file mode 100644 index 0000000000000000000000000000000000000000..e705975c900ffbb98d17ddd8c1de98b24056c5f0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/DelegateAfter.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.context.beans; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.camunda.bpm.engine.cdi.BusinessProcess; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +/** + * + * @author Daniel Meyer + * + */ +@Named +public class DelegateAfter implements JavaDelegate { + + @Inject + private BusinessProcess businessProcess; + + public void execute(DelegateExecution execution) throws Exception { + businessProcess.setVariable(getClass().getName(), true); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/DelegateBefore.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/DelegateBefore.java new file mode 100644 index 0000000000000000000000000000000000000000..db276b2df2643ec0c3a230712e0a9b2654bf042b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/DelegateBefore.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.context.beans; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.camunda.bpm.engine.cdi.BusinessProcess; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +/** + * + * @author Daniel Meyer + * + */ +@Named +public class DelegateBefore implements JavaDelegate { + + @Inject + private BusinessProcess businessProcess; + + public void execute(DelegateExecution execution) throws Exception { + businessProcess.setVariable(getClass().getName(), true); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/NoOpJavaDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/NoOpJavaDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..82714853a173395c17174766798c33d2fa433659 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/NoOpJavaDelegate.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.context.beans; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +public class NoOpJavaDelegate implements JavaDelegate { + + @Override + public void execute(DelegateExecution execution) throws Exception { + // do nothing + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/SignalableTask.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/SignalableTask.java new file mode 100644 index 0000000000000000000000000000000000000000..30f6e2e057ddf08508989a99de112f08a66e5053 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/beans/SignalableTask.java @@ -0,0 +1,34 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.context.beans; + +import org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior; +import org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution; + +public class SignalableTask extends AbstractBpmnActivityBehavior { + + @Override + public void execute(ActivityExecution execution) throws Exception { + // wait for signal + } + + @Override + public void signal(ActivityExecution execution, String signalName, Object signalData) throws Exception { + leave(execution); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/classes/MyPojo.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/classes/MyPojo.java new file mode 100644 index 0000000000000000000000000000000000000000..d785e91116a89f338440f33ebc9929cfe24d2731 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/context/classes/MyPojo.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.context.classes; + +public class MyPojo { + + public MyPojo() { + } + + public String name; + public int prio; + + public String getName() { + return name; + } + + public int getPrio() { + return prio; + } + + public void setName(String name) { + this.name = name; + } + + public void setPrio(int prio) { + this.prio = prio; + } + + } \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/database/PurgeDatabaseTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/database/PurgeDatabaseTest.java new file mode 100644 index 0000000000000000000000000000000000000000..fd09b4fcda93db7244ee72e51f3549a4986e8935 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/database/PurgeDatabaseTest.java @@ -0,0 +1,118 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.database; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.impl.HistoryLevelSetupCommand; +import org.camunda.bpm.engine.impl.ManagementServiceImpl; +import org.camunda.bpm.engine.impl.ProcessEngineImpl; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.impl.db.PersistenceSession; +import org.camunda.bpm.engine.impl.interceptor.Command; +import org.camunda.bpm.engine.impl.interceptor.CommandContext; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * @author Christopher Zell + */ +@RunWith(Arquillian.class) +public class PurgeDatabaseTest extends AbstractFoxPlatformIntegrationTest { + + public static final List TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK = Arrays.asList( + "ACT_GE_PROPERTY", + "ACT_GE_SCHEMA_LOG" + ); + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml"); + } + + @Test + public void testPurgeDatabase() { + Assert.assertNotNull(processEngine); + VariableMap variableMap = Variables.putValue("var", "value"); + runtimeService.startProcessInstanceByKey("testDeployProcessArchive", variableMap); + runtimeService.startProcessInstanceByKey("testDeployProcessArchive", variableMap); + + ManagementServiceImpl managementServiceImpl = (ManagementServiceImpl) managementService; + managementServiceImpl.purge(); + + assertAndEnsureCleanDb(processEngine); + } + + /** + * Ensures that the database is clean after the test. This means the test has to remove + * all resources it entered to the database. + * If the DB is not clean, it is cleaned by performing a create a drop. + * + * @param processEngine the {@link ProcessEngine} to check + * @param fail if true the method will throw an {@link AssertionError} if the database is not clean + * @return the database summary if fail is set to false or null if database was clean + * @throws AssertionError if the database was not clean and fail is set to true + */ + public static void assertAndEnsureCleanDb(ProcessEngine processEngine) { + ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration(); + String databaseTablePrefix = processEngineConfiguration.getDatabaseTablePrefix().trim(); + + Map tableCounts = processEngine.getManagementService().getTableCount(); + + StringBuilder outputMessage = new StringBuilder(); + for (String tableName : tableCounts.keySet()) { + String tableNameWithoutPrefix = tableName.replace(databaseTablePrefix, ""); + if (!TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK.contains(tableNameWithoutPrefix)) { + Long count = tableCounts.get(tableName); + if (count!=0L) { + outputMessage.append("\t").append(tableName).append(": ").append(count).append(" record(s)\n"); + } + } + } + + if (outputMessage.length() > 0) { + outputMessage.insert(0, "DB NOT CLEAN: \n"); + /** skip drop and recreate if a table prefix is used */ + if (databaseTablePrefix.isEmpty()) { + processEngineConfiguration + .getCommandExecutorSchemaOperations() + .execute(new Command() { + public Object execute(CommandContext commandContext) { + PersistenceSession persistenceSession = commandContext.getSession(PersistenceSession.class); + persistenceSession.dbSchemaDrop(); + persistenceSession.dbSchemaCreate(); + HistoryLevelSetupCommand.dbCreateHistoryLevel(commandContext); + return null; + } + }); + } + Assert.fail(outputMessage.toString()); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/delegation/DelegatedVariableMappingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/delegation/DelegatedVariableMappingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..acbe5d0020f09488c4b7662cd17c6c57b31752f4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/delegation/DelegatedVariableMappingTest.java @@ -0,0 +1,120 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.delegation; + +import org.camunda.bpm.integrationtest.functional.delegation.beans.DelegateVarMapping; +import javax.enterprise.inject.spi.BeanManager; +import javax.inject.Inject; +import static junit.framework.TestCase.assertEquals; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.engine.task.TaskQuery; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestConstants; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * + * @author Christopher Zell + */ +@RunWith(Arquillian.class) +public class DelegatedVariableMappingTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name = "mainDeployment") + public static WebArchive createProcessArchiveDeplyoment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "mainDeployment.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TestConstants.class) + .addClass(DelegateVarMapping.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/delegation/DelegatedVariableMappingTest.testCallSubProcessWithDelegatedVariableMapping.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/delegation/DelegatedVariableMappingTest.testCallSubProcessWithDelegatedVariableMappingExpression.bpmn20.xml"); + + TestContainer.addContainerSpecificResourcesEmbedCdiLib(webArchive); + + return webArchive; + } + + @Deployment(name = "calledDeployment") + public static WebArchive createSecondProcessArchiveDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "calledDeployment.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TestConstants.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/delegation/simpleSubProcess.bpmn20.xml"); + + TestContainer.addContainerSpecificResourcesEmbedCdiLib(webArchive); + + return webArchive; + } + + @Inject + private BeanManager beanManager; + + protected void testDelegation() { + TaskQuery taskQuery = taskService.createTaskQuery(); + + //when + Task taskInSubProcess = taskQuery.singleResult(); + assertEquals("Task in subprocess", taskInSubProcess.getName()); + + //then check value from input variable + Object inputVar = runtimeService.getVariable(taskInSubProcess.getProcessInstanceId(), "TestInputVar"); + assertEquals("inValue", inputVar); + + //when completing the task in the subprocess, finishes the subprocess + taskService.complete(taskInSubProcess.getId()); + Task taskAfterSubProcess = taskQuery.singleResult(); + assertEquals("Task after subprocess", taskAfterSubProcess.getName()); + + //then check value from output variable + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().singleResult(); + Object outputVar = runtimeService.getVariable(processInstance.getId(), "TestOutputVar"); + assertEquals("outValue", outputVar); + + //complete task after sub process + taskService.complete(taskAfterSubProcess.getId()); + } + + @Test + @OperateOnDeployment("mainDeployment") + public void testDelegateVariableMapping() { + //given + runtimeService.startProcessInstanceByKey("callSimpleSubProcess"); + testDelegation(); + } + + @Test + @OperateOnDeployment("mainDeployment") + public void testDelegateVariableMappingExpression() { + runtimeService.startProcessInstanceByKey("callSubProcessExpr"); + testDelegation(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/delegation/beans/DelegateVarMapping.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/delegation/beans/DelegateVarMapping.java new file mode 100644 index 0000000000000000000000000000000000000000..611c571f6f4b27d0f5823d0eefce67fabbe644be --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/delegation/beans/DelegateVarMapping.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.delegation.beans; + +import javax.inject.Named; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.DelegateVariableMapping; +import org.camunda.bpm.engine.delegate.VariableScope; +import org.camunda.bpm.engine.variable.VariableMap; +/** + * + * @author Christopher Zell + */ +@Named +public class DelegateVarMapping implements DelegateVariableMapping { + + @Override + public void mapInputVariables(DelegateExecution execution, VariableMap variables) { + variables.putValue("TestInputVar", "inValue"); + } + + @Override + public void mapOutputVariables(DelegateExecution execution, VariableScope subInstance) { + execution.setVariable("TestOutputVar", "outValue"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/dmn/BusinessRuleTaskVersionTagTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/dmn/BusinessRuleTaskVersionTagTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b42d7f3f21d64db73a46ea0c4bde48e54e654f5a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/dmn/BusinessRuleTaskVersionTagTest.java @@ -0,0 +1,64 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.dmn; + +import static org.junit.Assert.assertEquals; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.dmn.beans.VersionTagBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class BusinessRuleTaskVersionTagTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeployment() { + return initWebArchiveDeployment() + .addClass(VersionTagBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/dmn/BusinessRuleTaskVersionTagTest.testDecisionVersionTagOkay.dmn11.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/dmn/BusinessRuleTaskVersionTagTest.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment); + + return deployment; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testStartInstanceWithBeanCondition() { + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process"); + + assertEquals("okay", runtimeService.getVariable(processInstance.getId(), "result")); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/dmn/DmnHistoryTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/dmn/DmnHistoryTest.java new file mode 100644 index 0000000000000000000000000000000000000000..812354fe0ec1ae220fe1e0bcea23e663bab900f4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/dmn/DmnHistoryTest.java @@ -0,0 +1,68 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.dmn; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; + +import org.camunda.bpm.engine.history.HistoricDecisionInstance; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Philipp Ossler + */ +@RunWith(Arquillian.class) +public class DmnHistoryTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + + return initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/functional/dmn/BusinessRuleProcess.bpmn20.xml", "BusinessRuleProcess.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/dmn/Example.dmn11.xml", "Example.dmn11.xml"); + + } + + @Test + public void testHistoricDecisionInstance() { + + VariableMap variables = Variables.createVariables().putValue("status", "bronze").putValue("sum", 100); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess", variables); + + HistoricDecisionInstance historicDecisionInstance = historyService.createHistoricDecisionInstanceQuery().includeInputs().includeOutputs().singleResult(); + assertThat(historicDecisionInstance, is(notNullValue())); + assertThat(historicDecisionInstance.getDecisionDefinitionKey(), is("decision")); + assertThat(historicDecisionInstance.getDecisionDefinitionName(), is("Check Order")); + + assertThat(historicDecisionInstance.getInputs().size(), is(2)); + assertThat(historicDecisionInstance.getOutputs().size(), is(2)); + + Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); + taskService.complete(task.getId()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/dmn/beans/VersionTagBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/dmn/beans/VersionTagBean.java new file mode 100644 index 0000000000000000000000000000000000000000..0fc5764693a9ee40a7c1e79704e0ca375f205f39 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/dmn/beans/VersionTagBean.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.dmn.beans; + +import javax.inject.Named; + +@Named +public class VersionTagBean { + + public String versionTag() { + return "ver-0.1"; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/drools/TestDeploymentWithDroolsTaskFails.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/drools/TestDeploymentWithDroolsTaskFails.java new file mode 100644 index 0000000000000000000000000000000000000000..a1de6590965b115c1c3b59f756b5ba00727c70ad --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/drools/TestDeploymentWithDroolsTaskFails.java @@ -0,0 +1,66 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.drools; + +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.jboss.arquillian.container.test.api.Deployer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.RunAsClient; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * In this test we make sure that if a user deploys a WAR file with a broken + * .bpmn-XML file, the deployment fails. + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestDeploymentWithDroolsTaskFails { + + @ArquillianResource + private Deployer deployer; + + @Deployment(managed=false, name="deployment") + public static WebArchive processArchive() { + + return ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEjbClient()) + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/drools/TestDeploymentWithDroolsTaskFails.testDeployDroolsFails.bpmn20.xml"); + } + + @Test + @RunAsClient + public void testDeployDroolsFails() { + try { + deployer.deploy("deployment"); + Assert.fail("exception expected"); + }catch (Exception e) { + // expected + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/SFSBDelegateTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/SFSBDelegateTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2e677a81b904cda5916c82c3760cd161720dd121 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/SFSBDelegateTest.java @@ -0,0 +1,116 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.ejb; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.ejb.beans.SFSBClientDelegate; +import org.camunda.bpm.integrationtest.functional.ejb.beans.SFSBDelegate; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + + +/** + * Testcase verifying various ways to use a SFSB as a JavaDelegate + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class SFSBDelegateTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(SFSBDelegate.class) + .addClass(SFSBClientDelegate.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/ejb/SFSBDelegateTest.testBeanResolution.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/ejb/SFSBDelegateTest.testBeanResolutionFromClient.bpmn20.xml"); + } + + + @Test + public void testBeanResolution() { + + // this testcase first resolves the SFSB synchronouly and then from the JobExecutor + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testBeanResolution"); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), SFSBDelegate.class.getName())); + + runtimeService.setVariable(pi.getId(), SFSBDelegate.class.getName(), false); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), SFSBDelegate.class.getName())); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + + } + + + @Test + public void testBeanResolutionfromClient() { + + // this testcase invokes a CDI bean that injects the EJB + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testBeanResolutionfromClient"); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), SFSBDelegate.class.getName())); + + runtimeService.setVariable(pi.getId(), SFSBDelegate.class.getName(), false); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), SFSBDelegate.class.getName())); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + } + + @Test + public void testMultipleInvocations() { + + // this is greater than any Datasource- / EJB- / Thread-Pool size -> make sure all resources are released properly. + int instances = 100; + String[] ids = new String[instances]; + + for(int i=0; i make sure all resources are released properly. + int instances = 100; + String[] ids = new String[instances]; + + for(int i=0; i make sure all resources are released properly. + int instances = 100; + String[] ids = new String[instances]; + + for(int i=0; i make sure all resources are released properly. + int instances = 100; + String[] ids = new String[instances]; + + for(int i=0; i make sure all resources are released properly. + int instances = 100; + String[] ids = new String[instances]; + + for(int i=0; i + *
  • test.war - Process Application providing Processes (1+2)
  • + *
  • service.war - application providing a Local SLSB starting Process (2)
  • + * + * + * + * Expected Control flow: + * + *
    + *    test.war                                 service.war
    + *    ========                                 ===========
    + *
    + * start (unit test)
    + *   Process (1)
    + *      |
    + *      v
    + *   InvokeStartProcessDelegateSLSB  ---->    StartProcessSLSB
    + *                                               start Process (2)
    + *                                                  |
    + *                                                  V
    + *       CallbackBean         <-----------  Process Engine
    + *  
    + * + * + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class LocalSLSBInvocationWithCallbackTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name="pa", order=2) + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(InvokeStartProcessDelegateSLSB.class) + .addClass(CallbackBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/ejb/local/LocalSLSBInvocationTest.testStartProcess.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/ejb/local/LocalSLSBInvocationTest.callbackProcess.bpmn20.xml") + .addAsWebInfResource("org/camunda/bpm/integrationtest/functional/ejb/local/jboss-deployment-structure.xml","jboss-deployment-structure.xml"); + } + + @Deployment(order=1) + public static WebArchive delegateDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "service.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(StartProcessSLSB.class) + .addClass(StartProcessInterface.class) + .addAsManifestResource(new StringAsset("Dependencies: org.camunda.bpm.camunda-engine"), "MANIFEST.MF"); // get access to engine classes + + TestContainer.addContainerSpecificResourcesForNonPa(webArchive); + + return webArchive; + } + + @Test + @OperateOnDeployment("pa") + public void testInvokeBean() throws Exception{ + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testInvokeBean"); + + Assert.assertEquals(true, runtimeService.getVariable(pi.getId(), "result")); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/local/LocalSingletonBeanInvocationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/local/LocalSingletonBeanInvocationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..cfba80b4c0d32216789fbee9a56883fe25ee5903 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/local/LocalSingletonBeanInvocationTest.java @@ -0,0 +1,118 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.ejb.local; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.ejb.local.bean.BusinessInterface; +import org.camunda.bpm.integrationtest.functional.ejb.local.bean.LocalSingletonBean; +import org.camunda.bpm.integrationtest.functional.ejb.local.bean.LocalSingletonBeanClientDelegateBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + + +/** + * This test verifies that a CDI Java Bean Delegate is able to inject and invoke the + * local business interface of a SingletonBean from a different application + * + * Note: + * - works on Jboss + * - not implemented on Glassfish + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class LocalSingletonBeanInvocationTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name="pa", order=2) + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(LocalSingletonBeanClientDelegateBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/ejb/local/LocalSingletonBeanInvocationTest.testInvokeBean.bpmn20.xml") + .addAsWebInfResource("org/camunda/bpm/integrationtest/functional/ejb/local/jboss-deployment-structure.xml","jboss-deployment-structure.xml"); + } + + @Deployment(order=1) + public static WebArchive delegateDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "service.war") + .addAsLibraries(DeploymentHelper.getEjbClient()) + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(LocalSingletonBean.class) // the EJB + .addClass(BusinessInterface.class); // the business interface + + TestContainer.addContainerSpecificResourcesForNonPa(webArchive); + + return webArchive; + } + + @Test + @OperateOnDeployment("pa") + public void testInvokeBean() throws Exception{ + + // this testcase first resolves the Bean synchronously and then from the JobExecutor + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testInvokeBean"); + + Assert.assertEquals(runtimeService.getVariable(pi.getId(), "result"), true); + + runtimeService.setVariable(pi.getId(), "result", false); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(runtimeService.getVariable(pi.getId(), "result"), true); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); + } + + @Test + public void testMultipleInvocations() { + + // this is greater than any Datasource / EJB / Thread Pool size -> make sure all resources are released properly. + int instances = 100; + String[] ids = new String[instances]; + + for(int i=0; i make sure all resources are released properly. + int instances = 100; + String[] ids = new String[instances]; + + for(int i=0; i make sure all resources are released properly. + int instances = 100; + String[] ids = new String[instances]; + + for(int i=0; i make sure all resources are released properly. + int instances = 100; + String[] ids = new String[instances]; + + for(int i=0; i the same bean instance was invoked 2 times! + Assert.assertEquals(2, variable); + + Task task = taskService.createTaskQuery() + .processInstanceId(pi.getProcessInstanceId()) + .singleResult(); + taskService.complete(task.getId()); + + waitForJobExecutorToProcessAllJobs(); + + variable = runtimeService.getVariable(pi.getId(), "invocationCounter"); + // now it's '1' again! -> new instance of the bean + Assert.assertEquals(1, variable); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/JobExecutorRequestContextRemoteInvocationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/JobExecutorRequestContextRemoteInvocationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..cf433bcfc8404ffbf93b98e39bcadac27901b581 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/JobExecutorRequestContextRemoteInvocationTest.java @@ -0,0 +1,99 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.ejb.request; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.functional.ejb.request.beans.InvocationCounter; +import org.camunda.bpm.integrationtest.functional.ejb.request.beans.InvocationCounterDelegateBean; +import org.camunda.bpm.integrationtest.functional.ejb.request.beans.InvocationCounterService; +import org.camunda.bpm.integrationtest.functional.ejb.request.beans.InvocationCounterServiceBean; +import org.camunda.bpm.integrationtest.functional.ejb.request.beans.InvocationCounterServiceLocal; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * This test verifies that if a delegate bean invoked from the Job Executor + * calls a REMOTE SLSB from a different deployment, the RequestContext is active there as well. + * + * NOTE: + * - does not work on Jboss AS with a remote invocation (Bug in Jboss AS?) SEE HEMERA-2453 + * - works on Glassfish + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class JobExecutorRequestContextRemoteInvocationTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name="pa", order=2) + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(InvocationCounterDelegateBean.class) + .addClass(InvocationCounterService.class) // interface (remote) + .addAsResource("org/camunda/bpm/integrationtest/functional/ejb/request/JobExecutorRequestContextRemoteInvocationTest.testContextPropagationEjbRemote.bpmn20.xml"); + } + + @Deployment(order=1) + public static WebArchive delegateDeployment() { + return ShrinkWrap.create(WebArchive.class, "service.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(InvocationCounter.class) // @RequestScoped CDI bean + .addClass(InvocationCounterService.class) // interface (remote) + .addClass(InvocationCounterServiceLocal.class) // interface (local) + .addClass(InvocationCounterServiceBean.class); // @Stateless ejb + } + + + @Test + @OperateOnDeployment("pa") + public void testRequestContextPropagationEjbRemote() { + + // This test verifies that if a delegate bean invoked from the Job Executor + // calls an EJB from a different deployment, the RequestContext is active there as well. + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testContextPropagationEjbRemote"); + + waitForJobExecutorToProcessAllJobs(); + + Object variable = runtimeService.getVariable(pi.getId(), "invocationCounter"); + Assert.assertEquals(1, variable); + + // set the variable back to 0 + runtimeService.setVariable(pi.getId(), "invocationCounter", 0); + + Task task = taskService.createTaskQuery() + .processInstanceId(pi.getProcessInstanceId()) + .singleResult(); + taskService.complete(task.getId()); + + waitForJobExecutorToProcessAllJobs(); + + variable = runtimeService.getVariable(pi.getId(), "invocationCounter"); + // now it's '1' again! -> new instance of the bean + Assert.assertEquals(1, variable); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/JobExecutorRequestContextSFSBDelegateTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/JobExecutorRequestContextSFSBDelegateTest.java new file mode 100644 index 0000000000000000000000000000000000000000..de3214432ce6af50465ad58524eb16ba53f66d58 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/JobExecutorRequestContextSFSBDelegateTest.java @@ -0,0 +1,113 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.ejb.request; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.functional.ejb.request.beans.RequestScopedSFSBDelegate; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * This test verifies that if the same @RequestScoped SFSB Bean is invoked multiple times + * in the context of the same job, we get the same instance. + * + * NOTE: + * - works on Jboss AS + * - broken on Glassfish, see HEMERA-2454 + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class JobExecutorRequestContextSFSBDelegateTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name="pa", order=2) + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(RequestScopedSFSBDelegate.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/ejb/request/JobExecutorRequestContextSFSBDelegateTest.testScopingSFSB.bpmn20.xml"); + } + + + @Test + @OperateOnDeployment("pa") + public void testScopingSFSB() { + + // verifies that if the same @RequestScoped SFSB Bean is invoked multiple times + // in the context of the same job, we get the same instance + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testScopingSFSB"); + + waitForJobExecutorToProcessAllJobs(); + + Object variable = runtimeService.getVariable(pi.getId(), "invocationCounter"); + // -> the same bean instance was invoked 2 times! + Assert.assertEquals(2, variable); + + Task task = taskService.createTaskQuery() + .processInstanceId(pi.getProcessInstanceId()) + .singleResult(); + taskService.complete(task.getId()); + + waitForJobExecutorToProcessAllJobs(); + + variable = runtimeService.getVariable(pi.getId(), "invocationCounter"); + // now it's '1' again! -> new instance of the bean + Assert.assertEquals(1, variable); + + } + + @Test + public void testMultipleInvocations() { + + // this is greater than any Datasource- / EJB- / Thread-Pool size -> make sure all resources are released properly. + int instances = 100; + String[] ids = new String[instances]; + + for(int i=0; i the same bean instance was invoked 2 times! + Assert.assertEquals(2, variable); + + taskService.complete(taskService.createTaskQuery().processInstanceId(ids[i]).singleResult().getId()); + } + + waitForJobExecutorToProcessAllJobs(60*1000); + + for(int i=0; i new instance of the bean + Assert.assertEquals(1, runtimeService.getVariable(ids[i], "invocationCounter")); + } + + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounter.java new file mode 100644 index 0000000000000000000000000000000000000000..25abbe09ee92756cd9979d388d9e67eb3a2fcdf3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounter.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.ejb.request.beans; + +import javax.enterprise.context.RequestScoped; + +/** + * Simple request scoped bean keeping an invocation count. + * + * @author Daniel Meyer + * + */ +@RequestScoped +public class InvocationCounter { + + private int invocations; + + public int incrementAndGet() { + return ++invocations; + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterDelegateBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterDelegateBean.java new file mode 100644 index 0000000000000000000000000000000000000000..dec3a34f6f5a5c5f55794c0f35b9b70f90f97a42 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterDelegateBean.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.ejb.request.beans; + +import javax.inject.Named; +import javax.naming.InitialContext; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.camunda.bpm.integrationtest.util.TestConstants; + + +/** + * + * @author Daniel Meyer + * + */ +@Named +public class InvocationCounterDelegateBean implements JavaDelegate { + + public void execute(DelegateExecution execution) throws Exception { + InvocationCounterService invocationCounterService = (InvocationCounterService) new InitialContext().lookup("java:global/" + + TestConstants.getAppName() + + "service/" + + "InvocationCounterServiceBean!org.camunda.bpm.integrationtest.functional.ejb.request.beans.InvocationCounterService"); + + execution.setVariable("invocationCounter", invocationCounterService.getNumOfInvocations()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterDelegateBeanLocal.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterDelegateBeanLocal.java new file mode 100644 index 0000000000000000000000000000000000000000..fbbf562507bace2af4cb5cd6b4695f3b26f641cb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterDelegateBeanLocal.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.ejb.request.beans; + +import javax.ejb.EJB; +import javax.inject.Named; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +/** + * + * @author Daniel Meyer + * + */ +@Named +public class InvocationCounterDelegateBeanLocal implements JavaDelegate { + + @EJB(lookup="java:global/" + + "service/" + + "InvocationCounterServiceBean!org.camunda.bpm.integrationtest.functional.ejb.request.beans.InvocationCounterServiceLocal") + private InvocationCounterServiceLocal invocationCounterService; + + public void execute(DelegateExecution execution) throws Exception { + execution.setVariable("invocationCounter", invocationCounterService.getNumOfInvocations()); + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterService.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterService.java new file mode 100644 index 0000000000000000000000000000000000000000..fca93f6286ab6504b144540da538206bac86ef0f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterService.java @@ -0,0 +1,24 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.ejb.request.beans; + + +public interface InvocationCounterService { + + public int getNumOfInvocations(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterServiceBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterServiceBean.java new file mode 100644 index 0000000000000000000000000000000000000000..b282ee758e66a27faea867b7d73e9d8c16e947ee --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterServiceBean.java @@ -0,0 +1,36 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.ejb.request.beans; + +import javax.ejb.Local; +import javax.ejb.Remote; +import javax.ejb.Stateless; +import javax.inject.Inject; + +@Stateless +@Remote(InvocationCounterService.class) +@Local(InvocationCounterServiceLocal.class) +public class InvocationCounterServiceBean implements InvocationCounterService, InvocationCounterServiceLocal { + + @Inject + private InvocationCounter invocationCounter; + + public int getNumOfInvocations() { + return invocationCounter.incrementAndGet(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterServiceLocal.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterServiceLocal.java new file mode 100644 index 0000000000000000000000000000000000000000..a1629b3ab8571379d6b593d8579cd36d141c594a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/InvocationCounterServiceLocal.java @@ -0,0 +1,24 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.ejb.request.beans; + + +public interface InvocationCounterServiceLocal { + + public int getNumOfInvocations(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/RequestScopedSFSBDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/RequestScopedSFSBDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..5c34fe800448b96c8083a3e27a1379d880cefbe7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/ejb/request/beans/RequestScopedSFSBDelegate.java @@ -0,0 +1,44 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.ejb.request.beans; + +import javax.ejb.Stateful; +import javax.enterprise.context.RequestScoped; +import javax.inject.Named; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +/** + * A request scoped Stateful Session Bean acting as as a JavaDelegate + * + * @author Daniel Meyer + * + */ +@Named +@Stateful +@RequestScoped +public class RequestScopedSFSBDelegate implements JavaDelegate { + + private int invocationCounter = 0; + + public void execute(DelegateExecution execution) throws Exception { + invocationCounter++; + execution.setVariable("invocationCounter", invocationCounter); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/DecisionContextSwitchTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/DecisionContextSwitchTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a8351ece9e4acaceecd1815b9117108b59d76fb1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/DecisionContextSwitchTest.java @@ -0,0 +1,174 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.el; + +import static org.junit.Assert.assertEquals; + +import java.util.List; +import java.util.Map; + +import org.camunda.bpm.dmn.engine.DmnDecisionTableResult; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.runtime.VariableInstance; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.integrationtest.functional.el.beans.GreeterBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class DecisionContextSwitchTest extends AbstractFoxPlatformIntegrationTest { + + protected static final String DMN_RESOURCE_NAME = "org/camunda/bpm/integrationtest/functional/el/BeanResolvingDecision.dmn11.xml"; + + @Deployment(name="bpmnDeployment") + public static WebArchive createBpmnDeployment() { + return initWebArchiveDeployment("bpmn-deployment.war") + .addAsResource("org/camunda/bpm/integrationtest/functional/el/BusinessRuleProcess.bpmn20.xml"); + } + + @Deployment(name="dmnDeployment") + public static WebArchive createDmnDeployment() { + return initWebArchiveDeployment("dmn-deployment.war") + .addClass(GreeterBean.class) + .addAsResource(DMN_RESOURCE_NAME); + } + + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void shouldSwitchContextWhenUsingDecisionService() { + DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableByKey("decision", Variables.createVariables()); + assertEquals("ok", decisionResult.getFirstResult().getFirstEntry()); + } + + @Test + @SuppressWarnings("unchecked") + @OperateOnDeployment("clientDeployment") + public void shouldSwitchContextWhenCallingFromBpmn() { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess"); + + VariableInstance decisionResult = runtimeService.createVariableInstanceQuery() + .processInstanceIdIn(pi.getId()) + .variableName("result").singleResult(); + List> result = (List>) decisionResult.getValue(); + assertEquals("ok", result.get(0).get("result")); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void shouldSwitchContextWhenUsingDecisionServiceAfterRedeployment() { + + // given + List deployments = repositoryService.createDeploymentQuery() + .list(); + + // find dmn deployment + org.camunda.bpm.engine.repository.Deployment dmnDeployment = null; + for (org.camunda.bpm.engine.repository.Deployment deployment : deployments) { + List resourceNames = repositoryService.getDeploymentResourceNames(deployment.getId()); + if(resourceNames.contains(DMN_RESOURCE_NAME)) { + dmnDeployment = deployment; + } + } + + if(dmnDeployment == null) { + Assert.fail("Expected to find DMN deployment"); + } + + org.camunda.bpm.engine.repository.Deployment deployment2 = repositoryService + .createDeployment() + .nameFromDeployment(dmnDeployment.getId()) + .addDeploymentResources(dmnDeployment.getId()) + .deploy(); + + try { + // when then + DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableByKey("decision", Variables.createVariables()); + assertEquals("ok", decisionResult.getFirstResult().getFirstEntry()); + } + finally { + repositoryService.deleteDeployment(deployment2.getId(), true); + } + + } + + @Test + @SuppressWarnings("unchecked") + @OperateOnDeployment("clientDeployment") + public void shouldSwitchContextWhenCallingFromBpmnAfterRedeployment() { + // given + List deployments = repositoryService.createDeploymentQuery() + .list(); + + // find dmn deployment + org.camunda.bpm.engine.repository.Deployment dmnDeployment = null; + for (org.camunda.bpm.engine.repository.Deployment deployment : deployments) { + List resourceNames = repositoryService.getDeploymentResourceNames(deployment.getId()); + if(resourceNames.contains(DMN_RESOURCE_NAME)) { + dmnDeployment = deployment; + } + } + + if(dmnDeployment == null) { + Assert.fail("Expected to find DMN deployment"); + } + + org.camunda.bpm.engine.repository.Deployment deployment2 = repositoryService + .createDeployment() + .nameFromDeployment(dmnDeployment.getId()) + .addDeploymentResources(dmnDeployment.getId()) + .deploy(); + + try { + // when then + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess"); + + VariableInstance decisionResult = runtimeService.createVariableInstanceQuery() + .processInstanceIdIn(pi.getId()) + .variableName("result") + .singleResult(); + List> result = (List>) decisionResult.getValue(); + assertEquals("ok", result.get(0).get("result")); + } + finally { + repositoryService.deleteDeployment(deployment2.getId(), true); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/ElResolveStartFormDataTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/ElResolveStartFormDataTest.java new file mode 100644 index 0000000000000000000000000000000000000000..735d984423cc21966dede4b9881700efb5ab19d2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/ElResolveStartFormDataTest.java @@ -0,0 +1,64 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.el; + +import org.camunda.bpm.engine.form.StartFormData; +import org.camunda.bpm.integrationtest.functional.el.beans.ResolveFormDataBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Stefan Hentschel. + */ +@RunWith(Arquillian.class) +public class ElResolveStartFormDataTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(ResolveFormDataBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/el/elStartFormProcessWithFormData.bpmn20.xml"); + } + + @Test + public void testStartFormDataWithDefaultValueExpression() { + String processDefinitionId = repositoryService.createProcessDefinitionQuery().singleResult().getId(); + + StartFormData formData = formService.getStartFormData(processDefinitionId); + Object defaultValue = formData.getFormFields().get(0).getValue().getValue(); + + Assert.assertNotNull(defaultValue); + Assert.assertEquals("testString123", defaultValue); + } + + @Test + public void testStartFormDataWithLabelExpression() { + String processDefinitionId = repositoryService.createProcessDefinitionQuery().singleResult().getId(); + + StartFormData formData = formService.getStartFormData(processDefinitionId); + + String label = formData.getFormFields().get(0).getLabel(); + Assert.assertNotNull(label); + Assert.assertEquals("testString123", label); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/ElResolveTaskFormDataTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/ElResolveTaskFormDataTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7f63d2088a21e94188139c5a809b9f4cc39c4692 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/ElResolveTaskFormDataTest.java @@ -0,0 +1,68 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.el; + +import org.camunda.bpm.engine.form.TaskFormData; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.functional.el.beans.ResolveFormDataBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Stefan Hentschel. + */ +@RunWith(Arquillian.class) +public class ElResolveTaskFormDataTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(ResolveFormDataBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/el/elTaskFormProcessWithFormData.bpmn20.xml"); + } + + @Test + public void testTaskFormDataWithDefaultValueExpression() { + ProcessInstance instance = runtimeService.startProcessInstanceByKey("elTaskFormProcess"); + Task task = taskService.createTaskQuery().processInstanceId(instance.getId()).singleResult(); + + TaskFormData formData = formService.getTaskFormData(task.getId()); + Object defaultValue = formData.getFormFields().get(0).getValue().getValue(); + + Assert.assertNotNull(defaultValue); + Assert.assertEquals("testString123", defaultValue); + } + + @Test + public void testTaskFormDataWithLabelExpression() { + ProcessInstance instance = runtimeService.startProcessInstanceByKey("elTaskFormProcess"); + Task task = taskService.createTaskQuery().processInstanceId(instance.getId()).singleResult(); + + TaskFormData formData = formService.getTaskFormData(task.getId()); + + String label = formData.getFormFields().get(0).getLabel(); + Assert.assertNotNull(label); + Assert.assertEquals("testString123", label); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/ElResolverLookupTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/ElResolverLookupTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6269667ab37ede89b7cbfc256672cda1bbb7004e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/ElResolverLookupTest.java @@ -0,0 +1,56 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.el; + +import org.camunda.bpm.integrationtest.functional.el.beans.ResolveExpressionBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class ElResolverLookupTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name = "pa") + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(NullELResolver.class) + .addClass(ResolveExpressionBean.class) + .addAsResource( + "org/camunda/bpm/integrationtest/functional/el/services/org.camunda.bpm.application.ProcessApplicationElResolver", + "META-INF/services/org.camunda.bpm.application.ProcessApplicationElResolver") + .addAsResource("org/camunda/bpm/integrationtest/functional/el/elServiceTaskProcess.bpmn20.xml"); + } + + @Test + @OperateOnDeployment("pa") + public void testNullElResolverIsIgnored() { + // The expression should be resolved correctly although the NullElResolver + // is present + runtimeService.startProcessInstanceByKey("elServiceTaskProcess"); + + Assert.assertNotNull(taskService.createTaskQuery().singleResult()); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/NullELResolver.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/NullELResolver.java new file mode 100644 index 0000000000000000000000000000000000000000..b376cfedecd43100434b3006ec01686e9249fdf1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/NullELResolver.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.el; + +import org.camunda.bpm.application.AbstractProcessApplication; +import org.camunda.bpm.application.ProcessApplicationElResolver; +import org.camunda.bpm.impl.juel.jakarta.el.ELResolver; + +/** + * @author Thorben Lindhauer + * + */ +public class NullELResolver implements ProcessApplicationElResolver { + + /** + * Spring and CDI have 100 and 200 respectively + */ + public Integer getPrecedence() { + return 300; + } + + public ELResolver getElResolver(AbstractProcessApplication processApplication) { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/ResolveBeanFromDmnTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/ResolveBeanFromDmnTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5fab9e74caf47787938e491f4fc83fcd68d44bff --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/ResolveBeanFromDmnTest.java @@ -0,0 +1,58 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.el; + +import static org.junit.Assert.assertNotNull; + +import org.camunda.bpm.engine.runtime.VariableInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.functional.el.beans.GreeterBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class ResolveBeanFromDmnTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(GreeterBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/el/BusinessRuleProcess.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/el/BeanResolvingDecision.dmn11.xml"); + } + + @Test + public void testNullElResolverIsIgnored() { + runtimeService.startProcessInstanceByKey("testProcess"); + + Task task = taskService.createTaskQuery().singleResult(); + assertNotNull(task); + + VariableInstance decisionResult = runtimeService.createVariableInstanceQuery().variableName("result").singleResult(); + assertNotNull("The variable 'result' should exist", decisionResult); + assertNotNull("The value of the variable 'result' should not be null", decisionResult.getValue()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/beans/GreeterBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/beans/GreeterBean.java new file mode 100644 index 0000000000000000000000000000000000000000..702adceb26c0e61ae788e56b73eec469c7ce3588 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/beans/GreeterBean.java @@ -0,0 +1,32 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.el.beans; + +import javax.inject.Named; + +/** + * @author Daniel Meyer + * + */ +@Named("greeter") +public class GreeterBean { + + public String greet() { + return "hello"; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/beans/ResolveExpressionBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/beans/ResolveExpressionBean.java new file mode 100644 index 0000000000000000000000000000000000000000..ed478b9a8ce67ee67ccc2da4c9cccc50a19764db --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/beans/ResolveExpressionBean.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.el.beans; + +import javax.inject.Named; + +/** + * @author Thorben Lindhauer + * + */ +@Named +public class ResolveExpressionBean { + + public boolean getValue() { + return true; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/beans/ResolveFormDataBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/beans/ResolveFormDataBean.java new file mode 100644 index 0000000000000000000000000000000000000000..35869fd81b1b4da3264dc58a4801f3f0b6ac7223 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/el/beans/ResolveFormDataBean.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.el.beans; + +import javax.inject.Named; + +/** + * @author Thorben Lindhauer + * + */ +@Named +public class ResolveFormDataBean { + + public String getValue() { + return "testString123"; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/error/CatchErrorFromProcessApplicationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/error/CatchErrorFromProcessApplicationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..407f985a985985bd62494605e90d9b453fc5e836 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/error/CatchErrorFromProcessApplicationTest.java @@ -0,0 +1,570 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.error; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.Collections; +import java.util.Map; + +import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class CatchErrorFromProcessApplicationTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeployment() { + return initWebArchiveDeployment() + .addClass(ThrowErrorDelegate.class) + .addClass(MyBusinessException.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/error/CatchErrorFromProcessApplicationTest.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/error/CatchErrorFromProcessApplicationTest.delegateExpression.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/error/CatchErrorFromProcessApplicationTest.sequentialMultiInstance.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/error/CatchErrorFromProcessApplicationTest.delegateExpression.sequentialMultiInstance.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/error/CatchErrorFromProcessApplicationTest.parallelMultiInstance.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/error/CatchErrorFromProcessApplicationTest.delegateExpression.parallelMultiInstance.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPa(deployment); + + return deployment; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowExceptionInExecute() { + String pi = runtimeService.startProcessInstanceByKey("testProcess", throwException()).getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskException", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowErrorInExecute() { + String pi = runtimeService.startProcessInstanceByKey("testProcess", throwError()).getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskError", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowExceptionInSignal() { + String pi = runtimeService.startProcessInstanceByKey("testProcess").getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult(); + assertNotNull(serviceTask); + + runtimeService.setVariables(pi, throwException()); + runtimeService.signal(serviceTask.getId()); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskException", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowErrorInSignal() { + String pi = runtimeService.startProcessInstanceByKey("testProcess").getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult(); + assertNotNull(serviceTask); + + runtimeService.setVariables(pi, throwError()); + runtimeService.signal(serviceTask.getId()); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskError", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowExceptionInExecuteSequentialMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessSequentialMI", throwException()).getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskException", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowErrorInExecuteSequentialMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessSequentialMI", throwError()).getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskError", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowExceptionInSignalSequentialMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessSequentialMI").getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + // signal 2 times to execute first sequential behaviors + runtimeService.setVariables(pi, leaveExecution()); + runtimeService.signal(runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult().getId()); + runtimeService.setVariables(pi, leaveExecution()); + + Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult(); + assertNotNull(serviceTask); + + runtimeService.setVariables(pi, throwException()); + runtimeService.signal(serviceTask.getId()); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskException", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowErrorInSignalSequentialMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessSequentialMI").getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + // signal 2 times to execute first sequential behaviors + runtimeService.setVariables(pi, leaveExecution()); + runtimeService.signal(runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult().getId()); + runtimeService.setVariables(pi, leaveExecution()); + + runtimeService.signal(runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult().getId()); + Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult(); + assertNotNull(serviceTask); + + runtimeService.setVariables(pi, throwError()); + runtimeService.signal(serviceTask.getId()); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskError", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowExceptionInExecuteParallelMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessParallelMI", throwException()).getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskException", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowErrorInExecuteParallelMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessParallelMI", throwError()).getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskError", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowExceptionInSignalParallelMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessParallelMI").getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").list().get(3); + assertNotNull(serviceTask); + + runtimeService.setVariables(pi, throwException()); + runtimeService.signal(serviceTask.getId()); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskException", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowErrorInSignalParallelMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessParallelMI").getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").list().get(3); + assertNotNull(serviceTask); + + runtimeService.setVariables(pi, throwError()); + runtimeService.signal(serviceTask.getId()); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskError", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowExceptionInDelegateExpressionExecute() { + String pi = runtimeService.startProcessInstanceByKey("testProcess", throwException()).getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskException", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowErrorInDelegateExpressionExecute() { + String pi = runtimeService.startProcessInstanceByKey("testProcess", throwError()).getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskError", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowExceptionInDelegateExpressionSignal() { + String pi = runtimeService.startProcessInstanceByKey("testProcess").getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult(); + assertNotNull(serviceTask); + + runtimeService.setVariables(pi, throwException()); + runtimeService.signal(serviceTask.getId()); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskException", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowErrorInDelegateExpressionSignal() { + String pi = runtimeService.startProcessInstanceByKey("testProcess").getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult(); + assertNotNull(serviceTask); + + runtimeService.setVariables(pi, throwError()); + runtimeService.signal(serviceTask.getId()); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskError", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowExceptionInDelegateExpressionExecuteSequentialMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessSequentialMI", throwException()).getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskException", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowErrorInDelegateExpressionExecuteSequentialMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessSequentialMI", throwError()).getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskError", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowExceptionInDelegateExpressionSignalSequentialMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessSequentialMI").getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + // signal 2 times to execute first sequential behaviors + runtimeService.setVariables(pi, leaveExecution()); + runtimeService.signal(runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult().getId()); + runtimeService.setVariables(pi, leaveExecution()); + + Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult(); + assertNotNull(serviceTask); + + runtimeService.setVariables(pi, throwException()); + runtimeService.signal(serviceTask.getId()); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskException", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowErrorInDelegateExpressionSignalSequentialMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessSequentialMI").getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + // signal 2 times to execute first sequential behaviors + runtimeService.setVariables(pi, leaveExecution()); + runtimeService.signal(runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult().getId()); + runtimeService.setVariables(pi, leaveExecution()); + + runtimeService.signal(runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult().getId()); + Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult(); + assertNotNull(serviceTask); + + runtimeService.setVariables(pi, throwError()); + runtimeService.signal(serviceTask.getId()); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskError", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowExceptionInDelegateExpressionExecuteParallelMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessParallelMI", throwException()).getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskException", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowErrorInDelegateExpressionExecuteParallelMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessParallelMI", throwError()).getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskError", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowExceptionInDelegateExpressionSignalParallelMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessParallelMI").getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").list().get(3); + assertNotNull(serviceTask); + + runtimeService.setVariables(pi, throwException()); + runtimeService.signal(serviceTask.getId()); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskException", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testThrowErrorInDelegateExpressionSignalParallelMultiInstance() { + String pi = runtimeService.startProcessInstanceByKey("testProcessParallelMI").getId(); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertNull(runtimeService.getVariable(pi, "signaled")); + + Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").list().get(3); + assertNotNull(serviceTask); + + runtimeService.setVariables(pi, throwError()); + runtimeService.signal(serviceTask.getId()); + + assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); + assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); + + Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); + assertNotNull(userTask); + assertEquals("userTaskError", userTask.getTaskDefinitionKey()); + + taskService.complete(userTask.getId()); + } + + public Map throwError() { + return Collections.singletonMap("type", (Object) "error"); + } + + public Map throwException() { + return Collections.singletonMap("type", (Object) "exception"); + } + + public Map leaveExecution() { + return Collections.singletonMap("type", (Object) "leave"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/error/MyBusinessException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/error/MyBusinessException.java new file mode 100644 index 0000000000000000000000000000000000000000..227f4e012e1428f029360a9d4a4bc3f57cc63edc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/error/MyBusinessException.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.error; + +public class MyBusinessException extends Exception { + + public MyBusinessException(String message) { + super(message); + } + + public MyBusinessException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/error/ThrowErrorDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/error/ThrowErrorDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..fd7510a9a3dfb42a8a8d6a4d6a58a1c66a503911 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/error/ThrowErrorDelegate.java @@ -0,0 +1,53 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.error; + +import javax.inject.Named; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior; +import org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution; + +@Named +public class ThrowErrorDelegate extends AbstractBpmnActivityBehavior { + + @Override + public void execute(ActivityExecution execution) throws Exception { + handle(execution, "executed"); + } + + @Override + public void signal(ActivityExecution execution, String signalName, Object signalData) throws Exception { + handle(execution, "signaled"); + } + + protected void handle(ActivityExecution execution, String action) throws Exception { + execution.setVariable(action, true); + String type = (String) execution.getVariable("type"); + if ("error".equalsIgnoreCase(type)) { + throw new BpmnError("MyError"); + } + else if ("exception".equalsIgnoreCase(type)) { + throw new MyBusinessException("MyException"); + } + else if ("leave".equalsIgnoreCase(type)) { + execution.setVariable("type", null); + leave(execution); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/CdiProcessApplicationEventSupportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/CdiProcessApplicationEventSupportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..306ff2b0c0ceff92ba42208c5ba8b5ed4e1f5eb6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/CdiProcessApplicationEventSupportTest.java @@ -0,0 +1,78 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.event; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.functional.event.beans.CdiEventSupportProcessApplication; +import org.camunda.bpm.integrationtest.functional.event.beans.EventObserverCdiBean; +import org.camunda.bpm.integrationtest.functional.event.beans.ExecutionListenerProcessApplication; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.bpm.integrationtest.util.TestProcessApplication; +import org.jboss.arquillian.container.test.api.Deployer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class CdiProcessApplicationEventSupportTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createDeployment() { + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(CdiEventSupportProcessApplication.class) + .addClass(EventObserverCdiBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/event/ProcessApplicationEventSupportTest.testExecutionListener.bpmn20.xml"); + + TestContainer.addContainerSpecificResourcesForNonPa(archive); + + return archive; + + } + + @Test + public void testEventListener() { + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess"); + + Integer listenerInvocationCount = (Integer) runtimeService.getVariable(processInstance.getId(), ExecutionListenerProcessApplication.LISTENER_INVOCATION_COUNT); + Assert.assertNotNull(listenerInvocationCount); + Assert.assertEquals(6, listenerInvocationCount.intValue()); + + Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); + taskService.setAssignee(task.getId(), "demo"); + listenerInvocationCount = (Integer) runtimeService.getVariable(processInstance.getId(), ExecutionListenerProcessApplication.LISTENER_INVOCATION_COUNT); + + // assignment & update events fired + Assert.assertEquals(8, listenerInvocationCount.intValue()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/ProcessApplicationExecutionListenerTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/ProcessApplicationExecutionListenerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..19bbab8afeece3f6adcd3aa7f1c60158cff781ea --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/ProcessApplicationExecutionListenerTest.java @@ -0,0 +1,64 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.event; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.event.beans.ExecutionListenerProcessApplication; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class ProcessApplicationExecutionListenerTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createDeployment() { + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(ExecutionListenerProcessApplication.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/event/ProcessApplicationEventSupportTest.testExecutionListener.bpmn20.xml"); + + TestContainer.addContainerSpecificResourcesForNonPa(archive); + + return archive; + + } + + @Test + public void testExecutionListener() { + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess"); + + Integer listenerInvocationCount = (Integer) runtimeService.getVariable(processInstance.getId(), ExecutionListenerProcessApplication.LISTENER_INVOCATION_COUNT); + Assert.assertNotNull(listenerInvocationCount); + Assert.assertEquals(5, listenerInvocationCount.intValue()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/ProcessApplicationTaskListenerTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/ProcessApplicationTaskListenerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3bb0a91090aa729eb85fa76c87bdb6c151f72c39 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/ProcessApplicationTaskListenerTest.java @@ -0,0 +1,105 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.event; + +import org.camunda.bpm.engine.delegate.TaskListener; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.functional.event.beans.TaskListenerProcessApplication; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class ProcessApplicationTaskListenerTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createDeployment() { + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TaskListenerProcessApplication.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/event/ProcessApplicationEventSupportTest.testTaskListener.bpmn20.xml"); + + TestContainer.addContainerSpecificResourcesForNonPa(archive); + + return archive; + + } + + @Test + public void testTaskListener() { + Map variables = new HashMap(); + variables.put(TaskListener.EVENTNAME_CREATE, false); + variables.put(TaskListener.EVENTNAME_ASSIGNMENT, false); + variables.put(TaskListener.EVENTNAME_UPDATE, false); + variables.put(TaskListener.EVENTNAME_COMPLETE, false); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess", variables); + + boolean createEventFired = (Boolean) runtimeService.getVariable(processInstance.getId(), TaskListener.EVENTNAME_CREATE); + boolean assignmentEventFired = (Boolean) runtimeService.getVariable(processInstance.getId(), TaskListener.EVENTNAME_ASSIGNMENT); + boolean updateEventFired = (Boolean) runtimeService.getVariable(processInstance.getId(), TaskListener.EVENTNAME_UPDATE); + boolean completeEventFired = (Boolean) runtimeService.getVariable(processInstance.getId(), TaskListener.EVENTNAME_COMPLETE); + + Assert.assertTrue(createEventFired); + Assert.assertFalse(assignmentEventFired); + Assert.assertFalse(completeEventFired); + Assert.assertFalse(updateEventFired); + + Task task = taskService.createTaskQuery().processDefinitionKey("testProcess").singleResult(); + taskService.claim(task.getId(), "jonny"); + + createEventFired = (Boolean) runtimeService.getVariable(processInstance.getId(), TaskListener.EVENTNAME_CREATE); + assignmentEventFired = (Boolean) runtimeService.getVariable(processInstance.getId(), TaskListener.EVENTNAME_ASSIGNMENT); + updateEventFired = (Boolean) runtimeService.getVariable(processInstance.getId(), TaskListener.EVENTNAME_UPDATE); + completeEventFired = (Boolean) runtimeService.getVariable(processInstance.getId(), TaskListener.EVENTNAME_COMPLETE); + + Assert.assertTrue(createEventFired); + Assert.assertTrue(assignmentEventFired); + Assert.assertTrue(updateEventFired); + Assert.assertFalse(completeEventFired); + + taskService.complete(task.getId()); + + createEventFired = (Boolean) runtimeService.getVariable(processInstance.getId(), TaskListener.EVENTNAME_CREATE); + assignmentEventFired = (Boolean) runtimeService.getVariable(processInstance.getId(), TaskListener.EVENTNAME_ASSIGNMENT); + updateEventFired = (Boolean) runtimeService.getVariable(processInstance.getId(), TaskListener.EVENTNAME_UPDATE); + completeEventFired = (Boolean) runtimeService.getVariable(processInstance.getId(), TaskListener.EVENTNAME_COMPLETE); + + Assert.assertTrue(createEventFired); + Assert.assertTrue(assignmentEventFired); + Assert.assertTrue(updateEventFired); + Assert.assertTrue(completeEventFired); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/beans/CdiEventSupportProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/beans/CdiEventSupportProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..0ffcd2d143c02615107815945496eeb1d4d8c6db --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/beans/CdiEventSupportProcessApplication.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.event.beans; + +import org.camunda.bpm.application.ProcessApplication; +import org.camunda.bpm.engine.cdi.impl.event.CdiEventListener; +import org.camunda.bpm.engine.delegate.ExecutionListener; +import org.camunda.bpm.engine.delegate.TaskListener; + +/** + * @author Daniel Meyer + * + */ +@ProcessApplication +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class CdiEventSupportProcessApplication extends org.camunda.bpm.application.impl.ServletProcessApplication { + + public static final String LISTENER_INVOCATION_COUNT = "listenerInvocationCount"; + + public ExecutionListener getExecutionListener() { + return new CdiEventListener(); + } + + public TaskListener getTaskListener() { + return new CdiEventListener(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/beans/EventObserverCdiBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/beans/EventObserverCdiBean.java new file mode 100644 index 0000000000000000000000000000000000000000..74137a18ce1fbf642abb0029079dd6b630360c98 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/beans/EventObserverCdiBean.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.event.beans; + +import javax.enterprise.event.Observes; +import javax.inject.Inject; + +import org.camunda.bpm.engine.cdi.BusinessProcess; +import org.camunda.bpm.engine.cdi.BusinessProcessEvent; + +/** + * @author Daniel Meyer + * + */ +public class EventObserverCdiBean { + + public static final String LISTENER_INVOCATION_COUNT = "listenerInvocationCount"; + + @Inject + private BusinessProcess businessProcess; + + public void handleAllEvents(@Observes BusinessProcessEvent businessProcessEvent) { + + Integer listenerInvocationCount = businessProcess.getVariable(LISTENER_INVOCATION_COUNT); + if(listenerInvocationCount == null) { + listenerInvocationCount = 0; + } + + listenerInvocationCount += 1; + + businessProcess.setVariable(LISTENER_INVOCATION_COUNT, listenerInvocationCount); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/beans/ExecutionListenerProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/beans/ExecutionListenerProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..ec436fe6d25d37c78a6e38f04a4f7e380f7ea3e3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/beans/ExecutionListenerProcessApplication.java @@ -0,0 +1,50 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.event.beans; + +import org.camunda.bpm.application.ProcessApplication; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.ExecutionListener; + +/** + * @author Daniel Meyer + * + */ +@ProcessApplication +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class ExecutionListenerProcessApplication extends org.camunda.bpm.application.impl.ServletProcessApplication { + + public static final String LISTENER_INVOCATION_COUNT = "listenerInvocationCount"; + + public ExecutionListener getExecutionListener() { + return new ExecutionListener() { + public void notify(DelegateExecution execution) throws Exception { + + int listenerInvocationCount = 0; + + if(execution.hasVariable(LISTENER_INVOCATION_COUNT)) { + listenerInvocationCount = (Integer) execution.getVariable(LISTENER_INVOCATION_COUNT); + } + + listenerInvocationCount += 1; + + execution.setVariable(LISTENER_INVOCATION_COUNT, listenerInvocationCount); + } + }; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/beans/TaskListenerProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/beans/TaskListenerProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..963a8f601f5a661d8cbf23d7afd995bececaf004 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/event/beans/TaskListenerProcessApplication.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.event.beans; + +import org.camunda.bpm.application.ProcessApplication; +import org.camunda.bpm.engine.delegate.DelegateTask; +import org.camunda.bpm.engine.delegate.TaskListener; + +/** + * @author Daniel Meyer + * + */ +@ProcessApplication +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class TaskListenerProcessApplication extends org.camunda.bpm.application.impl.ServletProcessApplication { + + public static final String LISTENER_INVOCATION_COUNT = "listenerInvocationCount"; + + public TaskListener getTaskListener() { + return new TaskListener() { + public void notify(DelegateTask delegateTask) { + delegateTask.setVariable(delegateTask.getEventName(), true); + } + }; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jodatime/JodaTimeClassloadingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jodatime/JodaTimeClassloadingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..aa3a78d5e472df73616bb8dfeb2724ed08d379cf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jodatime/JodaTimeClassloadingTest.java @@ -0,0 +1,108 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.jodatime; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class JodaTimeClassloadingTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createDeployment() { + return initWebArchiveDeployment().addAsResource("org/camunda/bpm/integrationtest/functional/jodatime/JodaTimeClassloadingTest.bpmn20.xml"); + } + + + private Date testExpression(String timeExpression) { + // Set the clock fixed + HashMap variables1 = new HashMap(); + variables1.put("dueDate", timeExpression); + + // After process start, there should be timer created + ProcessInstance pi1 = runtimeService.startProcessInstanceByKey("intermediateTimerEventExample", variables1); + Assert.assertEquals(1, managementService.createJobQuery().processInstanceId(pi1.getId()).count()); + + List jobs = managementService.createJobQuery().executable().list(); + Assert.assertEquals(1, jobs.size()); + runtimeService.deleteProcessInstance(pi1.getId(), "test"); + + return jobs.get(0).getDuedate(); + } + + @Test + public void testTimeExpressionComplete() throws Exception { + Date dt = new Date(); + + Date dueDate = testExpression(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(dt)); + Assert.assertEquals(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(dt), new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(dueDate)); + } + + @Test + public void testTimeExpressionWithoutSeconds() throws Exception { + Date dt = new Date(); + + Date dueDate = testExpression(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm").format(dt)); + Assert.assertEquals(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm").format(dt), new SimpleDateFormat("yyyy-MM-dd'T'HH:mm").format(dueDate)); + } + + @Test + public void testTimeExpressionWithoutMinutes() throws Exception { + Date dt = new Date(); + + Date dueDate = testExpression(new SimpleDateFormat("yyyy-MM-dd'T'HH").format(new Date())); + Assert.assertEquals(new SimpleDateFormat("yyyy-MM-dd'T'HH").format(dt), new SimpleDateFormat("yyyy-MM-dd'T'HH").format(dueDate)); + } + + @Test + public void testTimeExpressionWithoutTime() throws Exception { + Date dt = new Date(); + + Date dueDate = testExpression(new SimpleDateFormat("yyyy-MM-dd").format(new Date())); + Assert.assertEquals(new SimpleDateFormat("yyyy-MM-dd").format(dt), new SimpleDateFormat("yyyy-MM-dd").format(dueDate)); + } + + @Test + public void testTimeExpressionWithoutDay() throws Exception { + Date dt = new Date(); + + Date dueDate = testExpression(new SimpleDateFormat("yyyy-MM").format(new Date())); + Assert.assertEquals(new SimpleDateFormat("yyyy-MM").format(dt), new SimpleDateFormat("yyyy-MM").format(dueDate)); + } + + @Test + public void testTimeExpressionWithoutMonth() throws Exception { + Date dt = new Date(); + + Date dueDate = testExpression(new SimpleDateFormat("yyyy").format(new Date())); + Assert.assertEquals(new SimpleDateFormat("yyyy").format(dt), new SimpleDateFormat("yyyy").format(dueDate)); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jpa/AsyncPersistenceDelegateBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jpa/AsyncPersistenceDelegateBean.java new file mode 100644 index 0000000000000000000000000000000000000000..1b1a0cf0af2d834132d1de6bdb6d2eeb685a52ac --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jpa/AsyncPersistenceDelegateBean.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.jpa; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.junit.Assert; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; + +@Named +@ApplicationScoped +public class AsyncPersistenceDelegateBean implements JavaDelegate { + + @PersistenceContext + private EntityManager em; + + private SomeEntity entity; + + public void execute(DelegateExecution execution) throws Exception { + + // we assert that the entity manager does not contain the entity + // this means that we obtain a seperate entity manager since + // we are invoked in a new transaction + + Assert.assertFalse(em.contains(entity)); + + } + + public void setEntity(SomeEntity entity) { + this.entity = entity; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jpa/JPAIntegrationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jpa/JPAIntegrationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..43a10c0364985d7a1dd4babb112a0f87845d0ca5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jpa/JPAIntegrationTest.java @@ -0,0 +1,122 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.jpa; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import javax.inject.Inject; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.transaction.UserTransaction; + + +/** + *

    Checks that activiti / application transaction sharing works as expected

    + * + * @author Daniel Meyer + */ +@RunWith(Arquillian.class) +public class JPAIntegrationTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(SomeEntity.class) + .addClass(PersistenceDelegateBean.class) + .addClass(AsyncPersistenceDelegateBean.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/jpa/TransactionIntegrationTest.testDelegateParticipateInApplicationTx.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/jpa/TransactionIntegrationTest.testAsyncDelegateNewTx.bpmn20.xml") + .addAsWebInfResource("persistence.xml", "classes/META-INF/persistence.xml"); + } + + @Inject + private UserTransaction utx; + + @Inject + private RuntimeService runtimeService; + + @PersistenceContext + private EntityManager entityManager; + + @Inject + private PersistenceDelegateBean persistenceDelegateBean; + + @Inject + private AsyncPersistenceDelegateBean asyncPersistenceDelegateBean; + + @Test + public void testDelegateParticipateInApplicationTx() throws Exception { + + /* if we start a transaction here, persist an entity and then + * start a process instance which synchronously invokes a java delegate, + * that delegate is invoked in the same transaction and thus has access to + * the same entity manager. + */ + + try { + utx.begin(); + + SomeEntity e = new SomeEntity(); + entityManager.persist(e); + + persistenceDelegateBean.setEntity(e); + + runtimeService.startProcessInstanceByKey("testDelegateParticipateInApplicationTx"); + + utx.commit(); + }catch (Exception e) { + utx.rollback(); + throw e; + } + } + + + @Test + public void testAsyncDelegateNewTx() throws Exception { + + /* if we start a transaction here, persist an entity and then + * start a process instance which asynchronously invokes a java delegate, + * that delegate is invoked in a new transaction and thus does not have access to + * the same entity manager. + */ + + try { + utx.begin(); + + SomeEntity e = new SomeEntity(); + entityManager.persist(e); + + asyncPersistenceDelegateBean.setEntity(e); + + runtimeService.startProcessInstanceByKey("testAsyncDelegateNewTx"); + + utx.commit(); + + }catch (Exception e) { + utx.rollback(); + throw e; + } + + waitForJobExecutorToProcessAllJobs(); + + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jpa/PersistenceDelegateBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jpa/PersistenceDelegateBean.java new file mode 100644 index 0000000000000000000000000000000000000000..caa77ea2f5ace48a010d80d699610f289d2dee22 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jpa/PersistenceDelegateBean.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.jpa; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.junit.Assert; + +@Named +@ApplicationScoped +public class PersistenceDelegateBean implements JavaDelegate { + + @PersistenceContext + private EntityManager em; + + private SomeEntity entity; + + public void execute(DelegateExecution execution) throws Exception { + + // we assert that the entity manager contains the entity + // this means that we obtain the same entity manager we used to + // persist the entity before starting the process + + Assert.assertTrue(em.contains(entity)); + + } + + public void setEntity(SomeEntity entity) { + this.entity = entity; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jpa/SomeEntity.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jpa/SomeEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..2e656473653ddd8816008d00f1995a03e06d09d2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/jpa/SomeEntity.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.jpa; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +@Entity +public class SomeEntity { + + @Id + @GeneratedValue + private Long id; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/message/IntermediateMessageCatchEventTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/message/IntermediateMessageCatchEventTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7f6acc899a8e78117d54c463bc3b0208a100d144 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/message/IntermediateMessageCatchEventTest.java @@ -0,0 +1,59 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.message; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class IntermediateMessageCatchEventTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeployment() { + return initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/functional/message/IntermediateMessageCatchEventTest.bpmn20.xml"); + } + + @Test + public void test() { + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess"); + + long eventSubscriptionCount = runtimeService.createEventSubscriptionQuery().count(); + assertEquals(1, eventSubscriptionCount); + + Execution execution = runtimeService.createExecutionQuery().messageEventSubscriptionName("Test Message").singleResult(); + + assertNotNull(execution); + + //runtimeService.messageEventReceived("Test Message", execution.getId()); + runtimeService.createMessageCorrelation("Test Message").correlate(); + + eventSubscriptionCount = runtimeService.createEventSubscriptionQuery().count(); + assertEquals(0, eventSubscriptionCount); + + assertEquals(0, runtimeService.createExecutionQuery().count()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/metadata/engine/TestMultipleProcessEnginesXmlsInLibrary.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/metadata/engine/TestMultipleProcessEnginesXmlsInLibrary.java new file mode 100644 index 0000000000000000000000000000000000000000..f506554aefd774f121afd6a132d5c08d220c03a0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/metadata/engine/TestMultipleProcessEnginesXmlsInLibrary.java @@ -0,0 +1,58 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.metadata.engine; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * This time, we have two process-engines.xml files in separate library jars. + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestMultipleProcessEnginesXmlsInLibrary extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + + return initWebArchiveDeployment() + .addAsLibraries( + ShrinkWrap.create(JavaArchive.class, "engine1.jar") + .addAsResource("singleEngine.xml", "META-INF/processes.xml"), + ShrinkWrap.create(JavaArchive.class, "engine2.jar") + .addAsResource("twoEngines.xml", "META-INF/processes.xml") + ); + } + + @Test + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngineService.getProcessEngine("engine1")); + Assert.assertNotNull(processEngineService.getProcessEngine("engine2")); + Assert.assertNotNull(processEngineService.getProcessEngine("engine3")); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/metadata/engine/TestProcessEnginesXmlFails.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/metadata/engine/TestProcessEnginesXmlFails.java new file mode 100644 index 0000000000000000000000000000000000000000..438c7de33ccdd11e2f3e23a25da20e64512c5574 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/metadata/engine/TestProcessEnginesXmlFails.java @@ -0,0 +1,71 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.metadata.engine; + +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.jboss.arquillian.container.test.api.Deployer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.RunAsClient; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestProcessEnginesXmlFails { + + @ArquillianResource + private Deployer deployer; + + @Deployment(managed=false, name="deployment") + public static WebArchive processArchive() { + + return ShrinkWrap.create(WebArchive.class) + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEjbClient()) + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addAsLibraries( + ShrinkWrap.create(JavaArchive.class, "engine1.jar") + .addAsResource("singleEngine.xml", "META-INF/processes.xml"), + ShrinkWrap.create(JavaArchive.class, "engine2.jar") + // we add the same process engine configuration multiple times -> fails + .addAsResource("singleEngine.xml", "META-INF/processes.xml") + ); + } + + @Test + @RunAsClient + public void testDeployProcessArchive() { + try { + deployer.deploy("deployment"); + Assert.fail("exception expected"); + }catch (Exception e) { + // expected + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/metadata/engine/TestProcessEnginesXmlInLibrary.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/metadata/engine/TestProcessEnginesXmlInLibrary.java new file mode 100644 index 0000000000000000000000000000000000000000..22df1c502d169845dbfbed315d2524c08fb10b30 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/metadata/engine/TestProcessEnginesXmlInLibrary.java @@ -0,0 +1,54 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.metadata.engine; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * This time, the process-engines.xml file is located in a library jar. + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestProcessEnginesXmlInLibrary extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + + return initWebArchiveDeployment() + .addAsLibraries(ShrinkWrap.create(JavaArchive.class, "engine1.jar") + .addAsResource("singleEngine.xml", "META-INF/processes.xml") + ); + + } + + @Test + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngineService.getProcessEngine("engine1")); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/metadata/engine/TestProcessEnginesXmlInProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/metadata/engine/TestProcessEnginesXmlInProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..38531276bb2715a07b90ece926c1e75f7e372dca --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/metadata/engine/TestProcessEnginesXmlInProcessApplication.java @@ -0,0 +1,58 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.metadata.engine; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestProcessEnginesXmlInProcessApplication extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource("singleEngine.xml", "META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(archive); + + return archive; + } + + @Test + public void testDeployProcessArchive() { + Assert.assertNotNull(processEngineService.getProcessEngine("engine1")); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/MigrationContextSwitchBeansTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/MigrationContextSwitchBeansTest.java new file mode 100644 index 0000000000000000000000000000000000000000..444b88898da5514c85009114068811a5cb0bc298 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/MigrationContextSwitchBeansTest.java @@ -0,0 +1,129 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.migration; + +import java.io.ByteArrayOutputStream; +import java.util.Arrays; + +import org.camunda.bpm.engine.migration.MigrationPlan; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.integrationtest.functional.migration.beans.TimerBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class MigrationContextSwitchBeansTest extends AbstractFoxPlatformIntegrationTest { + + public static final BpmnModelInstance ONE_TASK_PROCESS = Bpmn.createExecutableProcess("oneTaskProcess") + .camundaHistoryTimeToLive(180) + .startEvent() + .userTask("userTask") + .endEvent() + .done(); + + public static final BpmnModelInstance BOUNDARY_EVENT_PROCESS = Bpmn.createExecutableProcess("boundaryProcess") + .camundaHistoryTimeToLive(180) + .startEvent() + .userTask("userTask") + .boundaryEvent() + .timerWithDuration("${timerBean.duration}") + .endEvent() + .moveToNode("userTask") + .endEvent() + .done(); + + @Deployment(name = "sourceDeployment") + public static WebArchive createSourceDeplyoment() { + return initWebArchiveDeployment("source.war") + .addAsResource(modelAsAsset(ONE_TASK_PROCESS), "oneTaskProcess.bpmn20.xml"); + } + + @Deployment(name = "targetDeployment") + public static WebArchive createTargetDeplyoment() { + return initWebArchiveDeployment("target.war") + .addClass(TimerBean.class) + .addAsResource(modelAsAsset(BOUNDARY_EVENT_PROCESS), "boundaryProcess.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testCreateBoundaryTimer() { + // given + ProcessDefinition sourceDefinition = repositoryService + .createProcessDefinitionQuery() + .processDefinitionKey("oneTaskProcess") + .singleResult(); + + ProcessDefinition targetDefinition = repositoryService + .createProcessDefinitionQuery() + .processDefinitionKey("boundaryProcess") + .singleResult(); + + String pi = runtimeService.startProcessInstanceById(sourceDefinition.getId()).getId(); + + MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()) + .mapActivities("userTask", "userTask") + .build(); + + // when + runtimeService.newMigration(migrationPlan) + .processInstanceIds(Arrays.asList(pi)) + .execute(); + + // then + Job timerJob = managementService.createJobQuery().singleResult(); + Assert.assertNotNull(timerJob); + Assert.assertNotNull(timerJob.getDuedate()); + } + + protected static Asset modelAsAsset(BpmnModelInstance modelInstance) { + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + Bpmn.writeModelToStream(byteStream, modelInstance); + + byte[] bytes = byteStream.toByteArray(); + return new ByteArrayAsset(bytes); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/MigrationContextSwitchClassesTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/MigrationContextSwitchClassesTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a4563b5730c7377588ee19c896f576386b4829b9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/MigrationContextSwitchClassesTest.java @@ -0,0 +1,183 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.migration; + +import org.camunda.bpm.engine.delegate.ExecutionListener; +import org.camunda.bpm.engine.migration.MigrationPlan; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.integrationtest.functional.migration.beans.InstantiationListener; +import org.camunda.bpm.integrationtest.functional.migration.beans.RemovalListener; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.ByteArrayOutputStream; +import java.util.Arrays; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class MigrationContextSwitchClassesTest extends AbstractFoxPlatformIntegrationTest { + + public static final BpmnModelInstance oneTaskProcess(String key) { + return Bpmn.createExecutableProcess(key) + .camundaHistoryTimeToLive(180) + .startEvent() + .userTask("userTask") + .endEvent() + .done(); + } + + public static final BpmnModelInstance subProcessProcess(String key) { + return Bpmn.createExecutableProcess(key) + .camundaHistoryTimeToLive(180) + .startEvent() + .subProcess() + .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_START, InstantiationListener.class.getName()) + .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_END, RemovalListener.class.getName()) + .embeddedSubProcess() + .startEvent() + .userTask("userTask") + .endEvent() + .subProcessDone() + .endEvent() + .done(); + } + + public static final BpmnModelInstance BOUNDARY_EVENT_PROCESS = Bpmn.createExecutableProcess("boundaryProcess") + .camundaHistoryTimeToLive(180) + .startEvent() + .userTask("userTask") + .boundaryEvent() + .timerWithDuration("${timerBean.duration}") + .endEvent() + .moveToNode("userTask") + .endEvent() + .done(); + + @Deployment(name = "sourceDeployment") + public static WebArchive createSourceDeplyoment() { + return initWebArchiveDeployment("source.war") + .addClass(RemovalListener.class) + .addAsResource(modelAsAsset(oneTaskProcess("sourceOneTaskProcess")), "oneTaskProcess.bpmn20.xml") + .addAsResource(modelAsAsset(subProcessProcess("sourceSubProcess")), "subProcessProcess.bpmn20.xml"); + } + + @Deployment(name = "targetDeployment") + public static WebArchive createTargetDeplyoment() { + return initWebArchiveDeployment("target.war") + .addClass(InstantiationListener.class) + .addAsResource(modelAsAsset(oneTaskProcess("targetOneTaskProcess")), "oneTaskProcess.bpmn20.xml") + .addAsResource(modelAsAsset(subProcessProcess("targetSubProcess")), "subProcessProcess.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testCallStartListenerInTargetContext() { + // given + ProcessDefinition sourceDefinition = repositoryService + .createProcessDefinitionQuery() + .processDefinitionKey("sourceOneTaskProcess") + .singleResult(); + + ProcessDefinition targetDefinition = repositoryService + .createProcessDefinitionQuery() + .processDefinitionKey("targetSubProcess") + .singleResult(); + + String pi = runtimeService.startProcessInstanceById(sourceDefinition.getId()).getId(); + + MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()) + .mapActivities("userTask", "userTask") + .build(); + + // when + runtimeService.newMigration(migrationPlan) + .processInstanceIds(Arrays.asList(pi)) + .execute(); + + // then + Assert.assertTrue((Boolean)runtimeService.getVariable(pi, InstantiationListener.VARIABLE_NAME)); + } + + + @Test + @OperateOnDeployment("clientDeployment") + public void testCallEndListenerInTargetContext() { + // given + ProcessDefinition sourceDefinition = repositoryService + .createProcessDefinitionQuery() + .processDefinitionKey("sourceSubProcess") + .singleResult(); + + ProcessDefinition targetDefinition = repositoryService + .createProcessDefinitionQuery() + .processDefinitionKey("targetOneTaskProcess") + .singleResult(); + + String pi = runtimeService.createProcessInstanceById(sourceDefinition.getId()) + .startBeforeActivity("userTask") + .execute(true, true) // avoid InstantiationListener which is not present in targetDeployment + .getId(); + + + MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()) + .mapActivities("userTask", "userTask") + .build(); + + // when + runtimeService.newMigration(migrationPlan) + .processInstanceIds(Arrays.asList(pi)) + .execute(); + + // then + Assert.assertTrue((Boolean)runtimeService.getVariable(pi, RemovalListener.VARIABLE_NAME)); + } + + protected static Asset modelAsAsset(BpmnModelInstance modelInstance) { + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + Bpmn.writeModelToStream(byteStream, modelInstance); + + byte[] bytes = byteStream.toByteArray(); + return new ByteArrayAsset(bytes); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/beans/InstantiationListener.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/beans/InstantiationListener.java new file mode 100644 index 0000000000000000000000000000000000000000..f3a8fa1098a8ee210402010c753befcc9dc33664 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/beans/InstantiationListener.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.migration.beans; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.ExecutionListener; + +/** + * @author Thorben Lindhauer + * + */ +public class InstantiationListener implements ExecutionListener { + + public static final String VARIABLE_NAME = "startListenerCalled"; + + @Override + public void notify(DelegateExecution execution) throws Exception { + execution.setVariable(VARIABLE_NAME, true); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/beans/RemovalListener.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/beans/RemovalListener.java new file mode 100644 index 0000000000000000000000000000000000000000..622c5e8b0a13875161ea3aeb4b2926bf48634736 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/beans/RemovalListener.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.migration.beans; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.ExecutionListener; + +/** + * @author Thorben Lindhauer + * + */ +public class RemovalListener implements ExecutionListener { + + public static final String VARIABLE_NAME = "endListenerCalled"; + + @Override + public void notify(DelegateExecution execution) throws Exception { + execution.setVariable(VARIABLE_NAME, true); + } + +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/beans/TimerBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/beans/TimerBean.java new file mode 100644 index 0000000000000000000000000000000000000000..17492115593dab17b17b99c65f22e32f3e488ae6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/migration/beans/TimerBean.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.migration.beans; + +import javax.inject.Named; + +/** + * @author Thorben Lindhauer + * + */ +@Named +public class TimerBean { + + public String getDuration() { + return "PT5M"; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/modification/ModificationContextSwitchTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/modification/ModificationContextSwitchTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d3675849db7a5f1c8376851e2f293ad09a6e1553 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/modification/ModificationContextSwitchTest.java @@ -0,0 +1,76 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.modification; + +import org.camunda.bpm.engine.runtime.ProcessInstanceModificationInstantiationBuilder; +import org.camunda.bpm.integrationtest.functional.modification.beans.ExampleDelegate; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class ModificationContextSwitchTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createProcessArchiveDeplyoment() { + return initWebArchiveDeployment() + .addClass(ExampleDelegate.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/modification/ModificationContextSwitchTest.testModificationClassloading.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testModificationClassloading() { + // given + // process instance is in state "waitState" + String pi = runtimeService.startProcessInstanceByKey("testProcess").getId(); + Assert.assertNull(runtimeService.getVariable(pi, "executed")); + + // if + // we modify the process instance to start the next task: + ProcessInstanceModificationInstantiationBuilder modification = runtimeService.createProcessInstanceModification(pi) + .startBeforeActivity("ServiceTask_1"); + + // then + // the modification does not fail + modification.execute(); + Assert.assertTrue((Boolean)runtimeService.getVariable(pi, "executed")); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/modification/beans/ExampleDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/modification/beans/ExampleDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..b426c289524374f7cd7fb6382b5afb9beb0c20bd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/modification/beans/ExampleDelegate.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.modification.beans; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +/** + * @author Daniel Meyer + * + */ +public class ExampleDelegate implements JavaDelegate { + + public void execute(DelegateExecution execution) throws Exception { + execution.setVariable("executed", true); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/AbstractPaLocalScriptEngineTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/AbstractPaLocalScriptEngineTest.java new file mode 100644 index 0000000000000000000000000000000000000000..cd283d77689d3a212d51eccc13adfc3621ebba96 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/AbstractPaLocalScriptEngineTest.java @@ -0,0 +1,87 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +import org.camunda.bpm.application.ProcessApplicationInterface; +import org.camunda.bpm.application.ProcessApplicationReference; +import org.camunda.bpm.application.ProcessApplicationUnavailableException; +import org.camunda.bpm.engine.impl.application.ProcessApplicationManager; +import org.camunda.bpm.engine.impl.interceptor.Command; +import org.camunda.bpm.engine.impl.interceptor.CommandContext; +import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.junit.runner.RunWith; + +/** + * @author Roman Smirnov + * + */ +@RunWith(Arquillian.class) +public abstract class AbstractPaLocalScriptEngineTest extends AbstractFoxPlatformIntegrationTest { + + public static final String PROCESS_ID = "testProcess"; + public static final String SCRIPT_TEXT = "my-script"; + public static final String SCRIPT_FORMAT = "dummy"; + public static final String DUMMY_SCRIPT_ENGINE_FACTORY_SPI = "org.camunda.bpm.integrationtest.functional.scriptengine.engine.DummyScriptEngineFactory"; + public static final String SCRIPT_ENGINE_FACTORY_PATH = "META-INF/services/javax.script.ScriptEngineFactory"; + + protected static StringAsset createScriptTaskProcess(String scriptFormat, String scriptText) { + BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_ID) + .camundaHistoryTimeToLive(180) + .startEvent() + .scriptTask() + .scriptFormat(scriptFormat) + .scriptText(scriptText) + .camundaResultVariable("scriptValue") + .userTask() + .endEvent() + .done(); + return new StringAsset(Bpmn.convertToString(modelInstance)); + } + + protected ProcessApplicationInterface getProcessApplication() { + ProcessApplicationReference reference = processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command() { + public ProcessApplicationReference execute(CommandContext commandContext) { + ProcessDefinitionEntity definition = commandContext + .getProcessDefinitionManager() + .findLatestProcessDefinitionByKey(PROCESS_ID); + String deploymentId = definition.getDeploymentId(); + ProcessApplicationManager processApplicationManager = processEngineConfiguration.getProcessApplicationManager(); + return processApplicationManager.getProcessApplicationForDeployment(deploymentId); + } + }); + + assertNotNull(reference); + + ProcessApplicationInterface processApplication = null; + try { + processApplication = reference.getProcessApplication(); + } catch (ProcessApplicationUnavailableException e) { + fail("Could not retrieve process application"); + } + + return processApplication.getRawObject(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/AbstractScriptEngineSupportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/AbstractScriptEngineSupportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f9b248078666306f14ead0be948eda6997391b8e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/AbstractScriptEngineSupportTest.java @@ -0,0 +1,74 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +/** + * @author Sebastian Menski + */ +@RunWith(Arquillian.class) +public abstract class AbstractScriptEngineSupportTest extends AbstractFoxPlatformIntegrationTest { + + public static final String PROCESS_ID = "testProcess"; + public static final String EXAMPLE_SCRIPT = "execution.setVariable('foo', 'bar')"; + public static final String EXAMPLE_SPIN_SCRIPT = "execution.setVariable('bar', S('').name())"; + + public String processInstanceId; + + protected static StringAsset createScriptTaskProcess(String scriptFormat, String scriptTextPlain, String scriptTextSpin) { + BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_ID) + .camundaHistoryTimeToLive(180) + .startEvent() + .scriptTask() + .scriptFormat(scriptFormat) + .scriptText(scriptTextPlain) + .scriptTask() + .scriptFormat(scriptFormat) + .scriptText(scriptTextSpin) + .userTask() + .endEvent() + .done(); + return new StringAsset(Bpmn.convertToString(modelInstance)); + } + + @Test + public void shouldSetVariable() { + processInstanceId = runtimeService.startProcessInstanceByKey(PROCESS_ID).getId(); + } + + @After + public void variableFooShouldBeBar() { + Object foo = runtimeService.getVariable(processInstanceId, "foo"); + Object bar = runtimeService.getVariable(processInstanceId, "bar"); + assertNotNull(foo); + assertNotNull(bar); + assertEquals("bar", foo); + assertEquals("baz", bar); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/AbstractTemplateScriptEngineSupportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/AbstractTemplateScriptEngineSupportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..642dd366ddeabfcd8cf4247eb5cadb842299d81b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/AbstractTemplateScriptEngineSupportTest.java @@ -0,0 +1,70 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import java.util.HashMap; +import java.util.Map; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +/** + * @author Sebastian Menski + */ +@RunWith(Arquillian.class) +public abstract class AbstractTemplateScriptEngineSupportTest extends AbstractFoxPlatformIntegrationTest { + + public static final String PROCESS_ID = "testProcess"; + public static final String RESULT_VARIABLE = "foo"; + public static final String EXAMPLE_TEMPLATE = "Hello ${name}!"; + public static final String EXPECTED_RESULT = "Hello world!"; + + public String processInstanceId; + + protected static StringAsset createScriptTaskProcess(String scriptFormat, String scriptText) { + BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_ID) + .camundaHistoryTimeToLive(180) + .startEvent() + .scriptTask() + .scriptFormat(scriptFormat) + .scriptText(scriptText) + .camundaResultVariable(RESULT_VARIABLE) + .userTask() + .endEvent() + .done(); + return new StringAsset(Bpmn.convertToString(modelInstance)); + } + + @Test + public void shouldEvaluateTemplate() { + Map variables = new HashMap(); + variables.put("name", "world"); + processInstanceId = runtimeService.startProcessInstanceByKey(PROCESS_ID, variables).getId(); + + Object result = runtimeService.getVariable(processInstanceId, RESULT_VARIABLE); + assertNotNull(result); + assertEquals(EXPECTED_RESULT, result); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/CamundaScriptResourceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/CamundaScriptResourceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f4fb8ef8e21b02a97e977d0db5b5056c1365cce9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/CamundaScriptResourceTest.java @@ -0,0 +1,60 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import org.camunda.bpm.engine.history.HistoricVariableInstance; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class CamundaScriptResourceTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + + return initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/functional/scriptengine/CamundaScriptResourceTest.examplescript.js", "CamundaScriptResourceTest.examplescript.js") + .addAsResource("org/camunda/bpm/integrationtest/functional/scriptengine/CamundaScriptResourceTest.exampleprocess.bpmn", "CamundaScriptResourceTest.exampleprocess.bpmn"); + } + + @Test + public void testDeployProcessArchive() { + + // the process can successfully be executed + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess"); + + HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery() + .processInstanceId(pi.getId()) + .singleResult(); + + assertNotNull(variable); + assertEquals("executed", variable.getName()); + assertEquals(true, variable.getValue()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/FreeMarkerScriptEngineSupportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/FreeMarkerScriptEngineSupportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4e104d6f86f43734212754c18e80cda2ce704f60 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/FreeMarkerScriptEngineSupportTest.java @@ -0,0 +1,34 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.shrinkwrap.api.spec.WebArchive; + +/** + * @author Sebastian Menski + */ +public class FreeMarkerScriptEngineSupportTest extends AbstractTemplateScriptEngineSupportTest { + + @Deployment + public static WebArchive createProcessApplication() { + return initWebArchiveDeployment() + .addClass(AbstractTemplateScriptEngineSupportTest.class) + .addAsResource(createScriptTaskProcess("freemarker", EXAMPLE_TEMPLATE), "process.bpmn20.xml"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/GroovyAsyncScriptExecutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/GroovyAsyncScriptExecutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4f5ef35f6a838a27af344713616bc52c494dd923 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/GroovyAsyncScriptExecutionTest.java @@ -0,0 +1,82 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class GroovyAsyncScriptExecutionTest extends AbstractFoxPlatformIntegrationTest { + + protected static String process = + "\r\n" + + "\r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + ""; + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + TestContainer.addContainerSpecificResourcesForNonPa(deployment); + return deployment; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void shouldSetVariable() { + String deploymentId = repositoryService.createDeployment() + .addString("process.bpmn", process) + .deploy() + .getId(); + + String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); + waitForJobExecutorToProcessAllJobs(30000); + + Object foo = runtimeService.getVariable(processInstanceId, "foo"); + assertNotNull(foo); + assertEquals("bar", foo); + + repositoryService.deleteDeployment(deploymentId, true); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/GroovyPaClassImportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/GroovyPaClassImportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..603074290938820a5283da957e786b7954eee3e8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/GroovyPaClassImportTest.java @@ -0,0 +1,96 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.camunda.bpm.integrationtest.functional.scriptengine.classes.CustomClass; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class GroovyPaClassImportTest extends AbstractFoxPlatformIntegrationTest { + + public static final String SCRIPT_WITH_IMPORT = + "import org.camunda.bpm.integrationtest.functional.scriptengine.classes.CustomClass\n" + + "execution.setVariable('greeting', new CustomClass().greet())"; + + public static final String GROOVY_MODULE_DEPENDENCY = + "" + + "" + + " " + + " " + + " " + + " " + + " " + + ""; + + protected static StringAsset createScriptTaskProcess(String scriptFormat, String scriptText, String pdk) { + BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(pdk) + .camundaHistoryTimeToLive(180) + .startEvent() + .scriptTask() + .scriptFormat(scriptFormat) + .scriptText(scriptText) + .userTask() + .endEvent() + .done(); + return new StringAsset(Bpmn.convertToString(modelInstance)); + } + + @Deployment(name="pa1") + public static WebArchive createProcessApplication1() { + return initWebArchiveDeployment("pa1.war") + .addAsWebInfResource(new StringAsset(GROOVY_MODULE_DEPENDENCY),"jboss-deployment-structure.xml") + .addAsResource(createScriptTaskProcess("groovy", "", "process1"), "process1.bpmn20.xml"); + } + + @Deployment(name="pa2") + public static WebArchive createProcessApplication2() { + return initWebArchiveDeployment("pa2.war") + .addClass(CustomClass.class) + .addAsWebInfResource(new StringAsset(GROOVY_MODULE_DEPENDENCY),"jboss-deployment-structure.xml") + .addAsResource(createScriptTaskProcess("groovy", SCRIPT_WITH_IMPORT, "process2"), "process2.bpmn20.xml"); + } + + @Test + @OperateOnDeployment("pa1") + public void shouldSetVariable() { + // first start process 1 (this creates and caches the groovy engine) + runtimeService.startProcessInstanceByKey("process1").getId(); + + // then start process 2 + String processInstanceId = runtimeService.startProcessInstanceByKey("process2").getId(); + Object foo = runtimeService.getVariable(processInstanceId, "greeting"); + assertNotNull(foo); + assertEquals("Hi Ho", foo); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/GroovyScriptEngineSupportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/GroovyScriptEngineSupportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..81b0ba52f3c03b6c1bdf3812c01b2f88fce171cb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/GroovyScriptEngineSupportTest.java @@ -0,0 +1,34 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.shrinkwrap.api.spec.WebArchive; + +/** + * @author Sebastian Menski + */ +public class GroovyScriptEngineSupportTest extends AbstractScriptEngineSupportTest { + + @Deployment + public static WebArchive createProcessApplication() { + return initWebArchiveDeployment() + .addClass(AbstractScriptEngineSupportTest.class) + .addAsResource(createScriptTaskProcess("groovy", EXAMPLE_SCRIPT, EXAMPLE_SPIN_SCRIPT), "process.bpmn20.xml"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/JavascriptScriptEngineSupportGraalJsTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/JavascriptScriptEngineSupportGraalJsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..63246eac543ddb13c6bf300cda62a364fc1ea951 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/JavascriptScriptEngineSupportGraalJsTest.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.shrinkwrap.api.spec.WebArchive; + +public class JavascriptScriptEngineSupportGraalJsTest extends AbstractScriptEngineSupportTest { + + @Deployment + public static WebArchive createProcessApplication() { + return initWebArchiveDeployment() + .addClass(AbstractScriptEngineSupportTest.class) + .addAsResource(createScriptTaskProcess("graal.js", EXAMPLE_SCRIPT, EXAMPLE_SPIN_SCRIPT), "process.bpmn20.xml"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/JavascriptScriptEngineSupportNashornTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/JavascriptScriptEngineSupportNashornTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9dc6c3127189032997edc6004568238a1e5b636e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/JavascriptScriptEngineSupportNashornTest.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.shrinkwrap.api.spec.WebArchive; + +public class JavascriptScriptEngineSupportNashornTest extends AbstractScriptEngineSupportTest { + + @Deployment + public static WebArchive createProcessApplication() { + return initWebArchiveDeployment() + .addClass(AbstractScriptEngineSupportTest.class) + .addAsResource(createScriptTaskProcess("nashorn", EXAMPLE_SCRIPT, EXAMPLE_SPIN_SCRIPT), "process.bpmn20.xml"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/JavascriptScriptEngineSupportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/JavascriptScriptEngineSupportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e13ea10fdd736c0a366a95aea2efde1d5f149efb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/JavascriptScriptEngineSupportTest.java @@ -0,0 +1,34 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.shrinkwrap.api.spec.WebArchive; + +/** + * @author Sebastian Menski + */ +public class JavascriptScriptEngineSupportTest extends AbstractScriptEngineSupportTest { + + @Deployment + public static WebArchive createProcessApplication() { + return initWebArchiveDeployment() + .addClass(AbstractScriptEngineSupportTest.class) + .addAsResource(createScriptTaskProcess("javascript", EXAMPLE_SCRIPT, EXAMPLE_SPIN_SCRIPT), "process.bpmn20.xml"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineCallActivityConditionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineCallActivityConditionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..799be9b16201b904ab6513b520a74cf9e862f3e3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineCallActivityConditionTest.java @@ -0,0 +1,84 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.functional.scriptengine.engine.AbstractScriptEngineFactory; +import org.camunda.bpm.integrationtest.functional.scriptengine.engine.AlwaysTrueScriptEngineFactory; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Thorben Lindhauer + */ +@RunWith(Arquillian.class) +public class PaLocalScriptEngineCallActivityConditionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name="pa1") + public static WebArchive createCallingProcessDeployment() { + return initWebArchiveDeployment("pa1.war") + .addClass(AbstractScriptEngineFactory.class) + .addClass(AlwaysTrueScriptEngineFactory.class) + .addAsResource(new StringAsset(AlwaysTrueScriptEngineFactory.class.getName()), + PaLocalScriptEngineSupportTest.SCRIPT_ENGINE_FACTORY_PATH) + .addAsResource("org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineCallActivityConditionTest.callingProcessScriptConditionalFlow.bpmn20.xml"); + } + + @Deployment(name="pa2") + public static WebArchive createCalledProcessDeployment() { + return initWebArchiveDeployment("pa2.war") + .addAsResource("org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineCallActivityConditionTest.calledProcess.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResourcesForNonPa(deployment); + + return deployment; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void shouldEvaluateCondition() { + // given + runtimeService.startProcessInstanceByKey("callingProcessScriptConditionalFlow").getId(); + + Task calledProcessTask = taskService.createTaskQuery().singleResult(); + + // when the called process instance returns + taskService.complete(calledProcessTask.getId()); + + // then the conditional flow leaving the call activity has been taken + Task afterCallActivityTask = taskService.createTaskQuery().singleResult(); + Assert.assertNotNull(afterCallActivityTask); + Assert.assertEquals("afterCallActivityTask", afterCallActivityTask.getTaskDefinitionKey()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineDisabledCacheTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineDisabledCacheTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2a469d19cd93a07f218a4eedc4bf9ee7e508e65b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineDisabledCacheTest.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import static org.junit.Assert.assertNotEquals; + +import org.camunda.bpm.application.AbstractProcessApplication; +import org.camunda.bpm.integrationtest.functional.scriptengine.engine.AbstractScriptEngineFactory; +import org.camunda.bpm.integrationtest.functional.scriptengine.engine.DummyScriptEngineFactory; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; + +/** + * @author Roman Smirnov + * + */ +public class PaLocalScriptEngineDisabledCacheTest extends AbstractPaLocalScriptEngineTest { + + @Deployment + public static WebArchive createProcessApplication() { + return initWebArchiveDeployment() + .addClass(AbstractPaLocalScriptEngineTest.class) + .addClass(AbstractScriptEngineFactory.class) + .addClass(DummyScriptEngineFactory.class) + .addAsResource(new StringAsset(DUMMY_SCRIPT_ENGINE_FACTORY_SPI), SCRIPT_ENGINE_FACTORY_PATH) + .addAsResource(createScriptTaskProcess(SCRIPT_FORMAT, SCRIPT_TEXT), "process.bpmn20.xml"); + } + + @Test + public void shouldNotCacheScriptEngine() { + AbstractProcessApplication processApplication = (AbstractProcessApplication) getProcessApplication(); + assertNotEquals(processApplication.getScriptEngineForName(SCRIPT_FORMAT, false), processApplication.getScriptEngineForName(SCRIPT_FORMAT, false)); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineEnabledCacheTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineEnabledCacheTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d765a99f3ec04c9792055a0d8bef394cfc0c21b5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineEnabledCacheTest.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import static org.junit.Assert.assertEquals; + +import org.camunda.bpm.application.AbstractProcessApplication; +import org.camunda.bpm.integrationtest.functional.scriptengine.engine.AbstractScriptEngineFactory; +import org.camunda.bpm.integrationtest.functional.scriptengine.engine.DummyScriptEngineFactory; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; + +/** + * @author Roman Smirnov + * + */ +public class PaLocalScriptEngineEnabledCacheTest extends AbstractPaLocalScriptEngineTest { + + @Deployment + public static WebArchive createProcessApplication() { + return initWebArchiveDeployment() + .addClass(AbstractPaLocalScriptEngineTest.class) + .addClass(AbstractScriptEngineFactory.class) + .addClass(DummyScriptEngineFactory.class) + .addAsResource(new StringAsset(DUMMY_SCRIPT_ENGINE_FACTORY_SPI), SCRIPT_ENGINE_FACTORY_PATH) + .addAsResource(createScriptTaskProcess(SCRIPT_FORMAT, SCRIPT_TEXT), "process.bpmn20.xml"); + } + + @Test + public void shouldCacheScriptEngine() { + AbstractProcessApplication processApplication = (AbstractProcessApplication) getProcessApplication(); + assertEquals(processApplication.getScriptEngineForName(SCRIPT_FORMAT, true), processApplication.getScriptEngineForName(SCRIPT_FORMAT, true)); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineSupportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineSupportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..051a6ab69d55726df1847c93417f973c976d0819 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PaLocalScriptEngineSupportTest.java @@ -0,0 +1,54 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.camunda.bpm.integrationtest.functional.scriptengine.engine.AbstractScriptEngineFactory; +import org.camunda.bpm.integrationtest.functional.scriptengine.engine.DummyScriptEngineFactory; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; + +/** + * @author Roman Smirnov + * + */ + +public class PaLocalScriptEngineSupportTest extends AbstractPaLocalScriptEngineTest { + + @Deployment + public static WebArchive createProcessApplication() { + return initWebArchiveDeployment() + .addClass(AbstractPaLocalScriptEngineTest.class) + .addClass(AbstractScriptEngineFactory.class) + .addClass(DummyScriptEngineFactory.class) + .addAsResource(new StringAsset(DUMMY_SCRIPT_ENGINE_FACTORY_SPI), SCRIPT_ENGINE_FACTORY_PATH) + .addAsResource(createScriptTaskProcess(SCRIPT_FORMAT, SCRIPT_TEXT), "process.bpmn20.xml"); + } + + @Test + public void shouldSetVariable() { + String processInstanceId = runtimeService.startProcessInstanceByKey(PROCESS_ID).getId(); + Object scriptValue = runtimeService.getVariable(processInstanceId, "scriptValue"); + assertNotNull(scriptValue); + assertEquals(SCRIPT_TEXT, scriptValue); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PythonPaClassImportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PythonPaClassImportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..78e786fe81c969dc2680848c92ab61899a13e88c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PythonPaClassImportTest.java @@ -0,0 +1,96 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.camunda.bpm.integrationtest.functional.scriptengine.classes.CustomClass; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class PythonPaClassImportTest extends AbstractFoxPlatformIntegrationTest { + + public static final String SCRIPT_WITH_IMPORT = + "from org.camunda.bpm.integrationtest.functional.scriptengine.classes import CustomClass\n" + + "execution.setVariable('greeting', CustomClass().greet())"; + + public static final String JYTHON_MODULE_DEPENDENCY = + "" + + "" + + " " + + " " + + " " + + " " + + " " + + ""; + + protected static StringAsset createScriptTaskProcess(String scriptFormat, String scriptText, String pdk) { + BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(pdk) + .camundaHistoryTimeToLive(180) + .startEvent() + .scriptTask() + .scriptFormat(scriptFormat) + .scriptText(scriptText) + .userTask() + .endEvent() + .done(); + return new StringAsset(Bpmn.convertToString(modelInstance)); + } + + @Deployment(name="pa1") + public static WebArchive createProcessApplication1() { + return initWebArchiveDeployment("pa1.war") + .addAsWebInfResource(new StringAsset(JYTHON_MODULE_DEPENDENCY),"jboss-deployment-structure.xml") + .addAsResource(createScriptTaskProcess("python", "", "process1"), "process1.bpmn20.xml"); + } + + @Deployment(name="pa2") + public static WebArchive createProcessApplication2() { + return initWebArchiveDeployment("pa2.war") + .addClass(CustomClass.class) + .addAsWebInfResource(new StringAsset(JYTHON_MODULE_DEPENDENCY),"jboss-deployment-structure.xml") + .addAsResource(createScriptTaskProcess("python", SCRIPT_WITH_IMPORT, "process2"), "process2.bpmn20.xml"); + } + + @Test + @OperateOnDeployment("pa1") + public void shouldSetVariable() { + // first start process 1 (this creates and caches the python engine) + runtimeService.startProcessInstanceByKey("process1").getId(); + + // then start process 2 + String processInstanceId = runtimeService.startProcessInstanceByKey("process2").getId(); + Object foo = runtimeService.getVariable(processInstanceId, "greeting"); + assertNotNull(foo); + assertEquals("Hi Ho", foo); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PythonScriptEngineSupportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PythonScriptEngineSupportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1bf5b0a9570255ccd962bc82e39e9687081a8c4d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/PythonScriptEngineSupportTest.java @@ -0,0 +1,34 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.shrinkwrap.api.spec.WebArchive; + +/** + * @author Sebastian Menski + */ +public class PythonScriptEngineSupportTest extends AbstractScriptEngineSupportTest { + + @Deployment + public static WebArchive createProcessApplication() { + return initWebArchiveDeployment() + .addClass(AbstractScriptEngineSupportTest.class) + .addAsResource(createScriptTaskProcess("python", EXAMPLE_SCRIPT, EXAMPLE_SPIN_SCRIPT), "process.bpmn20.xml"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/RubyScriptEngineSupportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/RubyScriptEngineSupportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2b074afc3322cd5f464cbff2d418453a7d473c1c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/RubyScriptEngineSupportTest.java @@ -0,0 +1,34 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.shrinkwrap.api.spec.WebArchive; + +/** + * @author Sebastian Menski + */ +public class RubyScriptEngineSupportTest extends AbstractScriptEngineSupportTest { + + @Deployment + public static WebArchive createProcessApplication() { + return initWebArchiveDeployment() + .addClass(AbstractScriptEngineSupportTest.class) + .addAsResource(createScriptTaskProcess("ruby", "$" + EXAMPLE_SCRIPT, "$" + EXAMPLE_SPIN_SCRIPT), "process.bpmn20.xml"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/classes/CustomClass.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/classes/CustomClass.java new file mode 100644 index 0000000000000000000000000000000000000000..dea495b2dfd0d7086368af7527e162f36bf9465a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/classes/CustomClass.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine.classes; + +/** + * @author Daniel Meyer + * + */ +public class CustomClass { + + public String greet() { + return "Hi Ho"; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/engine/AbstractScriptEngineFactory.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/engine/AbstractScriptEngineFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..162d95686c4b164ea0382879a501a28dc8e11bcf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/engine/AbstractScriptEngineFactory.java @@ -0,0 +1,125 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine.engine; + +import java.io.Reader; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import javax.script.AbstractScriptEngine; +import javax.script.Bindings; +import javax.script.ScriptContext; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineFactory; +import javax.script.ScriptException; +import javax.script.SimpleBindings; + +/** + * @author Thorben Lindhauer + * + */ +public abstract class AbstractScriptEngineFactory implements ScriptEngineFactory { + + protected String name; + protected String version; + protected ScriptEngineBehavior behavior; + + public AbstractScriptEngineFactory(String name, String version, ScriptEngineBehavior behavior) { + this.name = name; + this.version = version; + this.behavior = behavior; + } + + public String getEngineName() { + return name; + } + + public String getEngineVersion() { + return version; + } + + public List getExtensions() { + return Collections.emptyList(); + } + + public List getMimeTypes() { + return Collections.emptyList(); + } + + public List getNames() { + return Arrays.asList(name); + } + + public String getLanguageName() { + return name; + } + + public String getLanguageVersion() { + return version; + } + + public Object getParameter(String key) { + if (key.equals("THREADING")) { + return "MULTITHREADED"; + } + return null; + } + + public String getMethodCallSyntax(String obj, String m, String... args) { + throw new UnsupportedOperationException("getMethodCallSyntax"); + } + + public String getOutputStatement(String toDisplay) { + throw new UnsupportedOperationException("getOutputStatement"); + } + + public String getProgram(String... statements) { + throw new UnsupportedOperationException("getProgram"); + } + + public ScriptEngine getScriptEngine() { + return new AbstractScriptEngine() { + + @Override + public Object eval(String script, ScriptContext context) throws ScriptException { + return behavior.eval(script, context); + } + + @Override + public Object eval(Reader reader, ScriptContext context) throws ScriptException { + return null; + } + + @Override + public Bindings createBindings() { + return new SimpleBindings(); + } + + @Override + public ScriptEngineFactory getFactory() { + return AbstractScriptEngineFactory.this; + } + + }; + } + + + public static interface ScriptEngineBehavior { + public Object eval(String script, ScriptContext context); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/engine/AlwaysTrueScriptEngineFactory.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/engine/AlwaysTrueScriptEngineFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..abf7f0457e187bde6727fd7a5aaef4bc87ff87e2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/engine/AlwaysTrueScriptEngineFactory.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine.engine; + +import javax.script.ScriptContext; + +/** + * @author Thorben Lindhauer + * + */ +public class AlwaysTrueScriptEngineFactory extends AbstractScriptEngineFactory { + + public AlwaysTrueScriptEngineFactory() { + super("always-true", "0.1.0", new ScriptEngineBehavior() { + + @Override + public Object eval(String script, ScriptContext context) { + return true; + } + }); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/engine/DummyScriptEngineFactory.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/engine/DummyScriptEngineFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..d4f94d15fbfb0e2a576f7c873038c622825bf039 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/scriptengine/engine/DummyScriptEngineFactory.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.scriptengine.engine; + +import javax.script.ScriptContext; + +/** + * @author Roman Smirnov + * + */ +public class DummyScriptEngineFactory extends AbstractScriptEngineFactory { + + public DummyScriptEngineFactory() { + super("dummy", "0.1.0", new ScriptEngineBehavior() { + + @Override + public Object eval(String script, ScriptContext context) { + return script; + } + }); + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/slf4j/Slf4jClassloadingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/slf4j/Slf4jClassloadingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d3bf8c9b1c0d4ba3af95aca675c2be11634dec16 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/slf4j/Slf4jClassloadingTest.java @@ -0,0 +1,77 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.slf4j; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.ILoggerFactory; +import org.slf4j.LoggerFactory; +import org.slf4j.helpers.NOPLoggerFactory; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +@RunWith(Arquillian.class) +public class Slf4jClassloadingTest extends AbstractFoxPlatformIntegrationTest { + + public static final String JDK14_LOGGER_FACTORY = "org.slf4j.impl.JDK14LoggerFactory"; + public static final String JBOSS_SLF4J_LOGGER_FACTORY = "org.slf4j.impl.Slf4jLoggerFactory"; + + @Deployment + public static WebArchive createDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsResource("META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TestLogger.class); + + TestContainer.addContainerSpecificResourcesWithoutWeld(webArchive); + TestContainer.addCommonLoggingDependency(webArchive); + + return webArchive; + } + + @Test + public void shouldNotUseNopLoggerFactory() { + ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory(); + + // verify that a SLF4J backend is used which is not the NOP logger + assertFalse("Should not use NOPLoggerFactory", loggerFactory instanceof NOPLoggerFactory); + + // should either use slf4j-jdk14 or slf4j-jboss-logmanager + String loggerFactoryClassName = loggerFactory.getClass().getCanonicalName(); + assertTrue("Should use slf4j-jdk14 or slf4j-jboss-logmanager", + JDK14_LOGGER_FACTORY.equals(loggerFactoryClassName) || JBOSS_SLF4J_LOGGER_FACTORY.equals(loggerFactoryClassName)); + } + + @Test + public void shouldBeAbleToLogMessageWithFormatParameters() { + TestLogger logger = TestLogger.INSTANCE; + + // verify that we can use different formatting methods + logger.testLogWithSingleFormatParameter(); + logger.testLogWithTwoFormatParameters(); + logger.testLogWithArrayFormatter(); + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/slf4j/TestLogger.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/slf4j/TestLogger.java new file mode 100644 index 0000000000000000000000000000000000000000..445e6639d2894b403556ad80bcaea2f252ce0e58 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/slf4j/TestLogger.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.slf4j; + +import org.camunda.commons.logging.BaseLogger; +import org.slf4j.helpers.MessageFormatter; + +public class TestLogger extends BaseLogger { + + public static final TestLogger INSTANCE = BaseLogger.createLogger(TestLogger.class, "QA", "org.camunda.bpm.qa", "01"); + + /** + * Verify that camunda commons log a messages with a single format parameter. + * The return type of {@link MessageFormatter#format(String, Object)} changed with slf4j-api:1.6.0 + */ + public void testLogWithSingleFormatParameter() { + logInfo("001", "This is a test of the SLF4J array formatter return type: {}", "Test test"); + } + + /** + * Verify that camunda commons log a messages with two format parameters. + * The return type of {@link MessageFormatter#format(String, Object, Object)} changed with slf4j-api:1.6.0 + */ + public void testLogWithTwoFormatParameters() { + logInfo("002", "This is a test of the SLF4J array formatter return type: {}, {}", "Test test", 123); + } + + /** + * Verify that camunda commons log a messages which uses the array formatter (more than two format parameters). + * The return type of {@link MessageFormatter#arrayFormat(String, Object[])} changed with slf4j-api:1.6.0 + */ + public void testLogWithArrayFormatter() { + // we must used at least 3 parameters to reach the array formatter + logInfo("003", "This is a test of the SLF4J array formatter return type: {}, {}, {}, {}", "Test test", 123, true, "it seems to work so slf4j >= 1.6.0 is used"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/FeelContextDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/FeelContextDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..efd6193276f8b449dbfd5966d2cd7d8caef1678d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/FeelContextDelegate.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import java.util.Map; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +public class FeelContextDelegate implements JavaDelegate { + + @Override + public void execute(DelegateExecution execution) throws Exception { + Map context = (Map) execution.getVariable("context"); + Map nestedMap = (Map) context.get("innerContext"); + + String content = (String) nestedMap.get("content"); + execution.setVariable("result", content); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/FeelEngineTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/FeelEngineTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b9054f1ec449af4c598fb54523836a5e190b9cef --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/FeelEngineTest.java @@ -0,0 +1,157 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import org.camunda.bpm.engine.history.HistoricDecisionInstance; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.spin.Spin; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.Arrays; +import java.util.List; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertEquals; + +@RunWith(Arquillian.class) +public class FeelEngineTest extends AbstractFoxPlatformIntegrationTest { + + protected static final String PATH = "org/camunda/bpm/integrationtest/functional/spin/feel/"; + + protected static final String DMN_JSON = "feel-spin-json-decision.dmn"; + protected static final String DMN_XML = "feel-spin-xml-decision.dmn"; + protected static final String PROCESS_JSON = "feel-spin-json-process.bpmn"; + protected static final String PROCESS_XML = "feel-spin-xml-process.bpmn"; + protected static final String FEEL_EXCLUSIVE_GATEWAY_BMPN = "feel-spin-process.bpmn"; + protected static final String FEEL_INPUT_OUTPUT_PROCESS_BPMN = "feel-spin-input-output.bpmn"; + + protected static final List TEST_LIST = Arrays.asList("\"foo\"", "\"bar\""); + + @Deployment(name="feel-deployment") + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + .addAsResource(PATH + DMN_JSON, DMN_JSON) + .addAsResource(PATH + DMN_XML, DMN_XML) + .addAsResource(PATH + PROCESS_JSON, PROCESS_JSON) + .addAsResource(PATH + PROCESS_XML, PROCESS_XML) + .addAsResource(PATH + FEEL_EXCLUSIVE_GATEWAY_BMPN, FEEL_EXCLUSIVE_GATEWAY_BMPN) + .addAsResource(PATH + FEEL_INPUT_OUTPUT_PROCESS_BPMN, FEEL_INPUT_OUTPUT_PROCESS_BPMN) + .addClass(FeelContextDelegate.class) + .addClass(JsonListSerializable.class) + .addClass(XmlListSerializable.class) + .addClass(AbstractFoxPlatformIntegrationTest.class); + } + + @Test + public void shouldExecuteProcessWithJSONVariableCorrectly() { + // given + VariableMap varMap = createSpinParsedVariableInMap("JSON"); + + // when + runtimeService.startProcessInstanceByKey("feel-spin-json-process", varMap); + + // then + HistoricDecisionInstance hdi = historyService.createHistoricDecisionInstanceQuery() + .decisionDefinitionKey("feel-spin-json-decision") + .includeOutputs() + .singleResult(); + + assertThat(hdi.getOutputs().size(), is(1)); + assertThat(hdi.getOutputs().get(0).getValue(), is(true)); + } + + @Test + public void shouldExecuteProcessWithXMLVariableCorrectly() { + // given + VariableMap varMap = createSpinParsedVariableInMap("XML"); + + // when + runtimeService.startProcessInstanceByKey("feel-spin-xml-process", varMap); + + // then + HistoricDecisionInstance hdi = historyService.createHistoricDecisionInstanceQuery() + .decisionDefinitionKey("feel-spin-xml-decision") + .includeOutputs() + .singleResult(); + + assertThat(hdi.getOutputs().size(), is(1)); + assertThat(hdi.getOutputs().get(0).getValue(), is(true)); + } + + @Test + public void testSpinIntegration() { + // Accessing SPIN object from FEEL requires the org.camunda.spin.plugin.impl.feel.integration.SpinValueMapper SPI + // given + VariableMap variablesLarge = Variables.createVariables().putValue("amount", Spin.JSON("{\"value\": 25}")); + VariableMap variablesSmall = Variables.createVariables().putValue("amount", Spin.JSON("{\"value\": 2}")); + + // when + ProcessInstance pi1 = runtimeService.startProcessInstanceByKey("feelScriptExecution", variablesLarge); + List resultsLarge = runtimeService.getActiveActivityIds(pi1.getId()); + + ProcessInstance pi2 = runtimeService.startProcessInstanceByKey("feelScriptExecution", variablesSmall); + List resultsSmall = runtimeService.getActiveActivityIds(pi2.getId()); + + // then + assertEquals(1, resultsLarge.size()); + assertEquals("taskRequestInvoice", resultsLarge.get(0)); + + assertEquals(1, resultsSmall.size()); + assertEquals("taskApprove", resultsSmall.get(0)); + } + + @Test + public void testFeelEngineComplexContext() { + // Mapping complex FEEL context into Java requires the org.camunda.feel.impl.JavaValueMapper SPI to be registered + // when + ProcessInstance pi = runtimeService.startProcessInstanceByKey("feelComplexContextProcess"); + String result = (String) runtimeService.getVariable(pi.getId(), "result"); + + // then + assertEquals("contentFromInnerContext", result); + } + + // HELPER + + protected VariableMap createSpinParsedVariableInMap(String serializationType) { + if ("json".equalsIgnoreCase(serializationType)) { + JsonListSerializable jsonList = new JsonListSerializable<>(); + jsonList.setListProperty(TEST_LIST); + return Variables.createVariables() + .putValue("inputVar", Spin.JSON(jsonList.toExpectedJsonString())); + + } else if ("xml".equalsIgnoreCase(serializationType)) { + XmlListSerializable xmlList = new XmlListSerializable<>(); + xmlList.setListProperty(TEST_LIST); + return Variables.createVariables() + .putValue("inputVar", Spin.XML(xmlList.toExpectedXmlString())); + + } else { + return Variables.createVariables(); + + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/JsonListSerializable.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/JsonListSerializable.java new file mode 100644 index 0000000000000000000000000000000000000000..716e3f662e35c5529375e9c037cd3c5e53386eef --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/JsonListSerializable.java @@ -0,0 +1,55 @@ + +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import java.util.ArrayList; +import java.util.List; + +public class JsonListSerializable { + + private List listProperty; + + public JsonListSerializable() { + this.listProperty = new ArrayList(); + } + + public void setListProperty(List listProperty) { + this.listProperty = listProperty; + } + + public String toExpectedJsonString() { + StringBuilder jsonBuilder = new StringBuilder(); + + jsonBuilder.append("{\"listProperty\":["); + for (int i = 0; i < listProperty.size(); i++) { + jsonBuilder.append(listProperty.get(i)); + if (i < listProperty.size() - 1) { + jsonBuilder.append(","); + } + } + jsonBuilder.append("]}"); + + return jsonBuilder.toString(); + } + + public String toString() { + return toExpectedJsonString(); + } + + +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaContextSwitchCustomSerializerTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaContextSwitchCustomSerializerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..8bb3dcfec424fc841e893375bd893594c787e9a0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaContextSwitchCustomSerializerTest.java @@ -0,0 +1,133 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import java.util.concurrent.Callable; +import org.camunda.bpm.engine.runtime.ActivityInstance; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.CustomDataFormatConfigurator; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.XmlSerializableJsonDeserializer; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.XmlSerializableJsonSerializer; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.spin.DataFormats; +import org.camunda.spin.spi.DataFormatConfigurator; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; +import static org.camunda.bpm.application.ProcessApplicationContext.withProcessApplicationContext; +import static org.junit.Assert.assertEquals; + +@RunWith(Arquillian.class) +public class PaContextSwitchCustomSerializerTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name = "pa3") + public static WebArchive createDeployment1() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "pa3.war") + .addAsResource("META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(ProcessApplication3.class) + .addClass(XmlSerializable.class) + .addClass(XmlSerializableJsonDeserializer.class) + .addClass(XmlSerializableJsonSerializer.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/spin/paContextSwitchCustomSerializer.bpmn20.xml") + .addClass(CustomDataFormatConfigurator.class) + .addAsServiceProvider(DataFormatConfigurator.class, CustomDataFormatConfigurator.class); + + TestContainer.addSpinJacksonJsonDataFormat(webArchive); + + return webArchive; + } + + @Deployment(name = "pa4") + public static WebArchive createDeployment2() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "pa4.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource("META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(ProcessApplication4.class); + + return webArchive; + } + + /** + * Tests following scenario: + * 1. Process application 1 declares custom de-/serializer for object variable. Process is started with object variable within process application 1. + * 2. Process is modified within process application 2, so that variable deserialization is required -> correct deserializer is used. + */ + @Test + @OperateOnDeployment("pa3") + public void test() throws Exception { + + final ProcessInstance processInstance = withProcessApplicationContext(new Callable() { + + @Override + public ProcessInstance call() throws Exception { + final XmlSerializable var = new XmlSerializable(); + var.setProperty("jonny"); + return runtimeService.startProcessInstanceByKey("processWithTimer", Variables.createVariables() + .putValueTyped("testObject", Variables.objectValue(var).serializationDataFormat(DataFormats.JSON_DATAFORMAT_NAME).create())); + } + + }, "pa3"); + + withProcessApplicationContext(new Callable() { + + @Override + public Void call() throws Exception { + runtimeService.createProcessInstanceModification(processInstance.getProcessInstanceId()).startTransition("flow2") + .execute(); + return null; + } + + }, "pa4"); + + assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("exclusiveGateway").finished().count()); + + } + + public String getInstanceIdForActivity(ActivityInstance activityInstance, String activityId) { + ActivityInstance instance = getChildInstanceForActivity(activityInstance, activityId); + if (instance != null) { + return instance.getId(); + } + return null; + } + + public ActivityInstance getChildInstanceForActivity(ActivityInstance activityInstance, String activityId) { + if (activityId.equals(activityInstance.getActivityId())) { + return activityInstance; + } + + for (ActivityInstance childInstance : activityInstance.getChildActivityInstances()) { + ActivityInstance instance = getChildInstanceForActivity(childInstance, activityId); + if (instance != null) { + return instance; + } + } + + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaContextSwitchTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaContextSwitchTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3353d0e58d82c5ddbf07fb240ade43929c7071a0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaContextSwitchTest.java @@ -0,0 +1,110 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.camunda.bpm.application.ProcessApplicationContext; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.variable.value.SerializableValue; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.JsonDataFormatConfigurator; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.JsonSerializable; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.spin.spi.DataFormatConfigurator; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.concurrent.Callable; + +import static org.camunda.bpm.application.ProcessApplicationContext.withProcessApplicationContext; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class PaContextSwitchTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name = "pa1") + public static WebArchive createDeployment1() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "pa1.war") + .addAsResource("META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(ProcessApplication1.class) + .addClass(JsonSerializable.class) + .addClass(RuntimeServiceDelegate.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/spin/paContextSwitch.bpmn20.xml") + .addClass(JsonDataFormatConfigurator.class) + .addAsServiceProvider(DataFormatConfigurator.class, JsonDataFormatConfigurator.class); + + TestContainer.addSpinJacksonJsonDataFormat(webArchive); + + return webArchive; + } + + @Deployment(name = "pa2") + public static WebArchive createDeployment2() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "pa2.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource("META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(ProcessApplication2.class); + + return webArchive; + } + + /** + * This test ensures that when the {@link ProcessApplicationContext} API is used, + * the context switch is only performed for outer-most command and not if a second, nested + * command is executed; => in nested commands, the engine is already in the correct context + */ + @Test + @OperateOnDeployment("pa1") + public void testNoContextSwitchOnInnerCommand() throws Exception { + + ProcessInstance pi = withProcessApplicationContext(new Callable() { + + @Override + public ProcessInstance call() throws Exception { + return runtimeService.startProcessInstanceByKey("process"); + } + + }, "pa2"); + + JsonSerializable expectedJsonSerializable = RuntimeServiceDelegate.createJsonSerializable(); + String expectedJsonString = expectedJsonSerializable.toExpectedJsonString(JsonDataFormatConfigurator.DATE_FORMAT); + + SerializableValue serializedValue = runtimeService.getVariableTyped(pi.getId(), RuntimeServiceDelegate.VARIABLE_NAME, false); + String actualJsonString = serializedValue.getValueSerialized(); + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode actualJsonTree = objectMapper.readTree(actualJsonString); + JsonNode expectedJsonTree = objectMapper.readTree(expectedJsonString); + // JsonNode#equals makes a deep comparison + Assert.assertEquals(expectedJsonTree, actualJsonTree); + + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatAndPostDeployTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatAndPostDeployTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5d8e54b3dd1c1402a510649523f47134fc024937 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatAndPostDeployTest.java @@ -0,0 +1,65 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.Foo; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.FooDataFormat; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.FooDataFormatProvider; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.FooSpin; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.spin.spi.DataFormatProvider; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class PaDataFormatAndPostDeployTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createDeployment() { + + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war") + .addClass(PaDataformatAndPostDeployApp.class) + .addAsResource("META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsResource("org/camunda/bpm/integrationtest/oneTaskProcess.bpmn") + .addClass(Foo.class) + .addClass(FooDataFormat.class) + .addClass(FooDataFormatProvider.class) + .addClass(FooSpin.class) + .addAsServiceProvider(DataFormatProvider.class, FooDataFormatProvider.class); + + return archive; + + } + + @Test + public void shouldDeployApp() { + Assert.assertNotNull(BpmPlatform.getProcessApplicationService() + .getProcessApplicationInfo(PaDataformatAndPostDeployApp.PA_NAME)); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatConfiguratorFailingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatConfiguratorFailingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6ab95e4624062230657c918f46b5e7c7e56f2192 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatConfiguratorFailingTest.java @@ -0,0 +1,91 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.FailingJsonDataFormatConfigurator; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.JsonSerializable; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.spin.spi.DataFormatConfigurator; +import org.jboss.arquillian.container.test.api.Deployer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.Set; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class PaDataFormatConfiguratorFailingTest { + + @ArquillianResource + private Deployer deployer; + + @Deployment(managed = false, name = "deployment") + public static WebArchive createDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "PaDataFormatConfiguratorFailingTest.war") + .addAsResource("META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(ReferenceStoringProcessApplication.class) + .addAsResource("org/camunda/bpm/integrationtest/oneTaskProcess.bpmn") + .addClass(JsonSerializable.class) + .addClass(FailingJsonDataFormatConfigurator.class) + .addAsServiceProvider(DataFormatConfigurator.class, FailingJsonDataFormatConfigurator.class); + + TestContainer.addSpinJacksonJsonDataFormat(webArchive); + + return webArchive; + + } + + @Deployment(name = "checkDeployment") + public static WebArchive createCheckDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class); + TestContainer.addContainerSpecificResourcesForNonPa(webArchive); + return webArchive; + } + + @Before + public void setUp() { + try { + deployer.deploy("deployment"); + // The failing configurator provokes a RuntimeException in a servlet context listener. + // Apparently such an exception needs not cancel the deployment of a Java EE application. + // That means deployment fails for some servers and for others not. + // => we don't care if there is an exception here or not + }catch (Exception e) { + } + } + + @Test + @OperateOnDeployment("checkDeployment") + public void testNoProcessApplicationIsDeployed() { + Set registeredPAs = BpmPlatform.getProcessApplicationService().getProcessApplicationNames(); + Assert.assertTrue(registeredPAs.isEmpty()); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatConfiguratorJodaTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatConfiguratorJodaTest.java new file mode 100644 index 0000000000000000000000000000000000000000..01bd5a99e8614d632ac49bd9a32d2a747b0c887e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatConfiguratorJodaTest.java @@ -0,0 +1,100 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.camunda.bpm.application.ProcessApplicationContext; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats; +import org.camunda.bpm.engine.variable.value.ObjectValue; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.JodaJsonDataFormatConfigurator; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.JodaJsonSerializable; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.spin.spi.DataFormatConfigurator; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.joda.time.DateTime; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.IOException; +import java.util.Date; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class PaDataFormatConfiguratorJodaTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "PaDataFormatTest.war") + .addAsResource("META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(ReferenceStoringProcessApplication.class) + .addAsResource("org/camunda/bpm/integrationtest/oneTaskProcess.bpmn") + .addClass(JodaJsonSerializable.class) + .addClass(JodaJsonDataFormatConfigurator.class) + .addAsServiceProvider(DataFormatConfigurator.class, JodaJsonDataFormatConfigurator.class); + + TestContainer.addSpinJacksonJsonDataFormat(webArchive); + TestContainer.addJodaTimeJacksonModule(webArchive); + + return webArchive; + + } + + @Test + public void testPaLocalJodaConfiguration() throws JsonProcessingException, IOException { + // given a process instance + final ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess"); + + // when setting a variable in the context of a process application + Date date = new Date(JodaJsonSerializable.ONE_DAY_IN_MILLIS * 10); // 10th of January 1970 + JodaJsonSerializable jsonSerializable = new JodaJsonSerializable(new DateTime(date.getTime())); + + try { + ProcessApplicationContext.setCurrentProcessApplication(ReferenceStoringProcessApplication.INSTANCE); + runtimeService.setVariable(pi.getId(), + "jsonSerializable", + Variables.objectValue(jsonSerializable).serializationDataFormat(SerializationDataFormats.JSON).create()); + } finally { + ProcessApplicationContext.clear(); + } + + // then the process-application-local data format has been used to serialize the value + ObjectValue objectValue = runtimeService.getVariableTyped(pi.getId(), "jsonSerializable", false); + + String serializedValue = objectValue.getValueSerialized(); + String expectedSerializedValue = jsonSerializable.toExpectedJsonString(); + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode actualJsonTree = objectMapper.readTree(serializedValue); + JsonNode expectedJsonTree = objectMapper.readTree(expectedSerializedValue); + // JsonNode#equals makes a deep comparison + Assert.assertEquals(expectedJsonTree, actualJsonTree); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatConfiguratorTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatConfiguratorTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0c01b4046fc5f4ddb39618fab5eeb676226617bf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatConfiguratorTest.java @@ -0,0 +1,244 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.camunda.bpm.application.ProcessApplicationContext; +import org.camunda.bpm.engine.history.HistoricVariableInstance; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats; +import org.camunda.bpm.engine.variable.value.ObjectValue; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.ImplicitObjectValueUpdateHandler; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.JsonDataFormatConfigurator; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.JsonSerializable; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.spin.spi.DataFormatConfigurator; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.IOException; +import java.util.Date; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class PaDataFormatConfiguratorTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "PaDataFormatTest.war") + .addAsResource("META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(ReferenceStoringProcessApplication.class) + .addAsResource("org/camunda/bpm/integrationtest/oneTaskProcess.bpmn") + .addAsResource("org/camunda/bpm/integrationtest/functional/spin/implicitProcessVariableUpdate.bpmn") + .addAsResource("org/camunda/bpm/integrationtest/functional/spin/implicitTaskVariableUpdate.bpmn") + .addClass(JsonSerializable.class) + .addClass(ImplicitObjectValueUpdateHandler.class) + .addClass(JsonDataFormatConfigurator.class) + .addAsServiceProvider(DataFormatConfigurator.class, JsonDataFormatConfigurator.class); + + TestContainer.addSpinJacksonJsonDataFormat(webArchive); + + return webArchive; + + } + + /** + * Tests that the PA-local data format applies when a variable is set in + * the context of it + */ + @Test + public void testPaLocalFormatApplies() throws JsonProcessingException, IOException { + + // given a process instance + final ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess"); + + // when setting a variable in the context of a process application + Date date = new Date(JsonSerializable.ONE_DAY_IN_MILLIS * 10); // 10th of January 1970 + JsonSerializable jsonSerializable = new JsonSerializable(date); + + try { + ProcessApplicationContext.setCurrentProcessApplication(ReferenceStoringProcessApplication.INSTANCE); + runtimeService.setVariable(pi.getId(), + "jsonSerializable", + Variables.objectValue(jsonSerializable).serializationDataFormat(SerializationDataFormats.JSON).create()); + } finally { + ProcessApplicationContext.clear(); + } + + // then the process-application-local data format has been used to serialize the value + ObjectValue objectValue = runtimeService.getVariableTyped(pi.getId(), "jsonSerializable", false); + + String serializedValue = objectValue.getValueSerialized(); + String expectedSerializedValue = jsonSerializable.toExpectedJsonString(JsonDataFormatConfigurator.DATE_FORMAT); + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode actualJsonTree = objectMapper.readTree(serializedValue); + JsonNode expectedJsonTree = objectMapper.readTree(expectedSerializedValue); + // JsonNode#equals makes a deep comparison + Assert.assertEquals(expectedJsonTree, actualJsonTree); + } + + /** + * Tests that the PA-local format does not apply if the value is set outside of the context + * of the process application + */ + @Test + public void testPaLocalFormatDoesNotApply() throws JsonProcessingException, IOException { + + // given a process instance + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess"); + + // when setting a variable without a process-application cotnext + Date date = new Date(JsonSerializable.ONE_DAY_IN_MILLIS * 10); // 10th of January 1970 + JsonSerializable jsonSerializable = new JsonSerializable(date); + + runtimeService.setVariable(pi.getId(), + "jsonSerializable", + Variables.objectValue(jsonSerializable).serializationDataFormat(SerializationDataFormats.JSON).create()); + + // then the global data format is applied + ObjectValue objectValue = runtimeService.getVariableTyped(pi.getId(), "jsonSerializable", false); + + String serializedValue = objectValue.getValueSerialized(); + String expectedSerializedValue = jsonSerializable.toExpectedJsonString(); + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode actualJsonTree = objectMapper.readTree(serializedValue); + JsonNode expectedJsonTree = objectMapper.readTree(expectedSerializedValue); + // JsonNode#equals makes a deep comparison + Assert.assertEquals(expectedJsonTree, actualJsonTree); + } + + /** + * Tests that an implicit object value update happens in the context of the + * process application. + */ + @Test + public void testExecutionVariableImplicitObjectValueUpdate() throws JsonProcessingException, IOException { + + // given a process instance and a task + ProcessInstance pi = runtimeService.startProcessInstanceByKey("implicitProcessVariableUpdate"); + + // when setting a variable such that the process-application-local dataformat applies + Date date = new Date(JsonSerializable.ONE_DAY_IN_MILLIS * 10); // 10th of January 1970 + JsonSerializable jsonSerializable = new JsonSerializable(date); + try { + + ProcessApplicationContext.setCurrentProcessApplication(ReferenceStoringProcessApplication.INSTANCE); + runtimeService.setVariable(pi.getId(), + ImplicitObjectValueUpdateHandler.VARIABLE_NAME, + Variables.objectValue(jsonSerializable).serializationDataFormat(SerializationDataFormats.JSON).create()); + } finally { + ProcessApplicationContext.clear(); + } + + // and triggering an implicit update of the object value variable + Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); + taskService.complete(task.getId()); + + // then the process-application-local format was used for making the update + ObjectValue objectValue = runtimeService.getVariableTyped(pi.getId(), + ImplicitObjectValueUpdateHandler.VARIABLE_NAME, + false); + + ImplicitObjectValueUpdateHandler.addADay(jsonSerializable); + String serializedValue = objectValue.getValueSerialized(); + String expectedSerializedValue = jsonSerializable.toExpectedJsonString(JsonDataFormatConfigurator.DATE_FORMAT); + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode actualJsonTree = objectMapper.readTree(serializedValue); + JsonNode expectedJsonTree = objectMapper.readTree(expectedSerializedValue); + // JsonNode#equals makes a deep comparison + Assert.assertEquals(expectedJsonTree, actualJsonTree); + + // and it is also correct in the history + HistoricVariableInstance historicObjectValue = historyService + .createHistoricVariableInstanceQuery() + .processInstanceId(pi.getId()) + .variableName(ImplicitObjectValueUpdateHandler.VARIABLE_NAME) + .disableCustomObjectDeserialization() + .singleResult(); + + serializedValue = ((ObjectValue) historicObjectValue.getTypedValue()).getValueSerialized(); + actualJsonTree = objectMapper.readTree(serializedValue); + Assert.assertEquals(expectedJsonTree, actualJsonTree); + } + + @Test + public void testTaskVariableImplicitObjectValueUpdate() throws JsonProcessingException, IOException { + + // given a process instance + ProcessInstance pi = runtimeService.startProcessInstanceByKey("implicitTaskVariableUpdate"); + Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); + + // when setting a variable such that the process-application-local dataformat applies + Date date = new Date(JsonSerializable.ONE_DAY_IN_MILLIS * 10); // 10th of January 1970 + JsonSerializable jsonSerializable = new JsonSerializable(date); + try { + ProcessApplicationContext.setCurrentProcessApplication(ReferenceStoringProcessApplication.INSTANCE); + taskService.setVariableLocal(task.getId(), + ImplicitObjectValueUpdateHandler.VARIABLE_NAME, + Variables.objectValue(jsonSerializable).serializationDataFormat(SerializationDataFormats.JSON).create()); + } finally { + ProcessApplicationContext.clear(); + } + + // and triggering an implicit update of the object value variable + taskService.setAssignee(task.getId(), "foo"); + + // then the process-application-local format was used for making the update + ObjectValue objectValue = taskService.getVariableTyped(task.getId(), + ImplicitObjectValueUpdateHandler.VARIABLE_NAME, + false); + + ImplicitObjectValueUpdateHandler.addADay(jsonSerializable); + String serializedValue = objectValue.getValueSerialized(); + String expectedSerializedValue = jsonSerializable.toExpectedJsonString(JsonDataFormatConfigurator.DATE_FORMAT); + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode actualJsonTree = objectMapper.readTree(serializedValue); + JsonNode expectedJsonTree = objectMapper.readTree(expectedSerializedValue); + // JsonNode#equals makes a deep comparison + Assert.assertEquals(expectedJsonTree, actualJsonTree); + + // and it is also correct in the history + HistoricVariableInstance historicObjectValue = historyService + .createHistoricVariableInstanceQuery() + .processInstanceId(pi.getId()) + .variableName(ImplicitObjectValueUpdateHandler.VARIABLE_NAME) + .disableCustomObjectDeserialization() + .singleResult(); + + serializedValue = ((ObjectValue) historicObjectValue.getTypedValue()).getValueSerialized(); + actualJsonTree = objectMapper.readTree(serializedValue); + Assert.assertEquals(expectedJsonTree, actualJsonTree); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatProviderTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatProviderTest.java new file mode 100644 index 0000000000000000000000000000000000000000..50831c10de89adc89aac257672116000097a16e1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataFormatProviderTest.java @@ -0,0 +1,91 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import org.camunda.bpm.application.ProcessApplicationContext; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.engine.variable.value.ObjectValue; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.Foo; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.FooDataFormat; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.FooDataFormatProvider; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.FooSpin; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.spin.spi.DataFormatProvider; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.camunda.bpm.engine.variable.Variables.serializedObjectValue; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class PaDataFormatProviderTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "PaDataFormatTest.war") + .addAsResource("META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsResource("org/camunda/bpm/integrationtest/oneTaskProcess.bpmn") + .addClass(Foo.class) + .addClass(FooDataFormat.class) + .addClass(FooDataFormatProvider.class) + .addClass(FooSpin.class) + .addAsServiceProvider(DataFormatProvider.class, FooDataFormatProvider.class) + .addClass(ReferenceStoringProcessApplication.class); + + return webArchive; + } + + /** + * Tests that + * 1) a serialized value can be set OUT OF process application context + * even if the data format is not available (using the fallback serializer) + * 2) and that this value can be deserialized IN process application context + * by using the PA-local serializer + */ + @Test + public void customFormatCanBeUsedForVariableSerialization() { + final ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess", + Variables.createVariables() + .putValue("serializedObject", + serializedObjectValue("foo") + .serializationDataFormat(FooDataFormat.NAME) + .objectTypeName(Foo.class.getName()))); + + ObjectValue objectValue = null; + try { + ProcessApplicationContext.setCurrentProcessApplication(ReferenceStoringProcessApplication.INSTANCE); + objectValue = runtimeService.getVariableTyped(pi.getId(), "serializedObject", true); + } finally { + ProcessApplicationContext.clear(); + } + + Object value = objectValue.getValue(); + Assert.assertNotNull(value); + Assert.assertTrue(value instanceof Foo); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataformatAndPostDeployApp.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataformatAndPostDeployApp.java new file mode 100644 index 0000000000000000000000000000000000000000..1630d1c62f3cc81a8ec51c3533d06b0c95d258e2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaDataformatAndPostDeployApp.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import static org.junit.Assert.assertNotNull; + +import org.camunda.bpm.application.PostDeploy; +import org.camunda.bpm.application.ProcessApplication; +import org.camunda.bpm.engine.ProcessEngine; + + +/** + * @author Daniel Meyer + * + */ +@ProcessApplication(PaDataformatAndPostDeployApp.PA_NAME) +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class PaDataformatAndPostDeployApp extends org.camunda.bpm.application.impl.ServletProcessApplication { + + public final static String PA_NAME = "PaDataformatAndPostDeployApp"; + + @PostDeploy + public void onPaDeployed(ProcessEngine e) throws Exception { + + assertNotNull(getVariableSerializers()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaSpinSupportTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaSpinSupportTest.java new file mode 100644 index 0000000000000000000000000000000000000000..68b3755cdf3910d659136ab068fe18698d93bad6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/PaSpinSupportTest.java @@ -0,0 +1,121 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import static org.camunda.bpm.engine.variable.Variables.serializedObjectValue; +import static org.camunda.spin.Spin.JSON; +import static org.camunda.spin.Spin.XML; +import static org.junit.Assert.assertEquals; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; + +import org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.engine.variable.value.ObjectValue; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.spin.impl.util.SpinIoUtil; +import org.camunda.spin.json.SpinJsonNode; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + *

    Smoketest Make sure camunda spin can be used in a process application

    + * + * @author Daniel Meyer + */ +@RunWith(Arquillian.class) +public class PaSpinSupportTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createDeployment() { + return initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/oneTaskProcess.bpmn") + .addAsResource("org/camunda/bpm/integrationtest/functional/spin/jackson146.json"); + } + + @Test + public void spinShouldBeAvailable() { + Assert.assertEquals("someXml", XML("").xPath("/someXml").element().name()); + } + + @Test + public void spinCanBeUsedForVariableSerialization() { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess", Variables.createVariables() + .putValue("serializedObject", serializedObjectValue("{\"foo\": \"bar\"}").serializationDataFormat("application/json").objectTypeName(HashMap.class.getName()))); + + ObjectValue objectValue = runtimeService.getVariableTyped(pi.getId(), "serializedObject", true); + + HashMap expected = new HashMap(); + expected.put("foo", "bar"); + + Assert.assertEquals(expected, objectValue.getValue()); + } + + @Test + public void spinPluginShouldBeRegistered() { + + List processEnginePlugins = processEngineConfiguration.getProcessEnginePlugins(); + + boolean spinPluginFound = false; + + for (ProcessEnginePlugin plugin : processEnginePlugins) { + if (plugin.getClass().getName().contains("Spin")) { + spinPluginFound = true; + break; + } + } + + Assert.assertTrue(spinPluginFound); + } + + @Test + public void testJacksonBug146() { + InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream("org/camunda/bpm/integrationtest/functional/spin/jackson146.json"); + String jackson146 = SpinIoUtil.inputStreamAsString(resourceAsStream); + + // this should not fail + SpinJsonNode node = JSON(jackson146); + + // file has 4000 characters in length a + // 20 characters per repeated JSON object + assertEquals(200, node.prop("abcdef").elements().size()); + } + + @Test + public void testJacksonBug146AsVariable() { + InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream("org/camunda/bpm/integrationtest/functional/spin/jackson146.json"); + String jackson146 = SpinIoUtil.inputStreamAsString(resourceAsStream); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess", Variables.createVariables() + .putValue("jackson146", serializedObjectValue(jackson146).serializationDataFormat("application/json").objectTypeName(HashMap.class.getName()))); + + // file has 4000 characters in length a + // 20 characters per repeated JSON object + ObjectValue objectValue = runtimeService.getVariableTyped(pi.getId(), "jackson146", true); + HashMap> map = (HashMap>) objectValue.getValue(); + + assertEquals(200, map.get("abcdef").size()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ProcessApplication1.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ProcessApplication1.java new file mode 100644 index 0000000000000000000000000000000000000000..5e984a8cee56fa64f5a2376cc0500a2dda941ac1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ProcessApplication1.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import org.camunda.bpm.application.ProcessApplication; + +/** + * @author Thorben Lindhauer + * + */ +@ProcessApplication("pa1") +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class ProcessApplication1 extends org.camunda.bpm.application.impl.ServletProcessApplication { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ProcessApplication2.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ProcessApplication2.java new file mode 100644 index 0000000000000000000000000000000000000000..0b480404587cca42bdb3defa2a5e387918e2ad12 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ProcessApplication2.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import org.camunda.bpm.application.ProcessApplication; + +/** + * @author Thorben Lindhauer + * + */ +@ProcessApplication("pa2") +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class ProcessApplication2 extends org.camunda.bpm.application.impl.ServletProcessApplication { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ProcessApplication3.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ProcessApplication3.java new file mode 100644 index 0000000000000000000000000000000000000000..5781c90e95b55ff4539195502278b08c42dfdd4a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ProcessApplication3.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import org.camunda.bpm.application.ProcessApplication; + +@ProcessApplication("pa3") +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class ProcessApplication3 extends org.camunda.bpm.application.impl.ServletProcessApplication { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ProcessApplication4.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ProcessApplication4.java new file mode 100644 index 0000000000000000000000000000000000000000..821205ba3b7ea58178439b0d91d0e39b9ad548c1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ProcessApplication4.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import org.camunda.bpm.application.ProcessApplication; + +@ProcessApplication("pa4") +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class ProcessApplication4 extends org.camunda.bpm.application.impl.ServletProcessApplication { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ReferenceStoringProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ReferenceStoringProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..34525989e496e417799b2c5cea7b4ff8e0c9920e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/ReferenceStoringProcessApplication.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import org.camunda.bpm.application.PostDeploy; +import org.camunda.bpm.application.ProcessApplication; + +/** + * {@link org.camunda.bpm.application.impl.ServletProcessApplication} is fine on all containers as the tests + * don't require Java EE features + * + * @author Thorben Lindhauer + */ +@ProcessApplication +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class ReferenceStoringProcessApplication extends org.camunda.bpm.application.impl.ServletProcessApplication { + + public static ReferenceStoringProcessApplication INSTANCE = null; + + @PostDeploy + public void postDeploy() { + INSTANCE = this; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/RuntimeServiceDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/RuntimeServiceDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..d782166ace4619bb23d5fa02f81597b931f31aca --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/RuntimeServiceDelegate.java @@ -0,0 +1,53 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import java.util.Date; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats; +import org.camunda.bpm.engine.variable.value.ObjectValue; +import org.camunda.bpm.integrationtest.functional.spin.dataformat.JsonSerializable; + +/** + * @author Thorben Lindhauer + * + */ +public class RuntimeServiceDelegate implements JavaDelegate { + + public static final String VARIABLE_NAME = "var"; + + public void execute(DelegateExecution execution) throws Exception { + RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService(); + + ObjectValue jsonSerializeable = Variables + .objectValue(createJsonSerializable()) + .serializationDataFormat(SerializationDataFormats.JSON) + .create(); + + // this should be executed in the context of the current process application + runtimeService.setVariable(execution.getProcessInstanceId(), VARIABLE_NAME, jsonSerializeable); + + } + + public static JsonSerializable createJsonSerializable() { + return new JsonSerializable(new Date(JsonSerializable.ONE_DAY_IN_MILLIS * 10)); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/SpinClassloadingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/SpinClassloadingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..43a8342606c4d34bc7358097ad036dea43e85a4c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/SpinClassloadingTest.java @@ -0,0 +1,74 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.camunda.bpm.engine.variable.Variables.*; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class SpinClassloadingTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name="pa") + public final static WebArchive createPaDeployment() { + + return initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/functional/spin/SpinClassloadingTest.bpmn") + .addClass(XmlSerializable.class) + .addClass(SpinVariableDelegate.class) + .addClass(SpinJsonPathDelegate.class); + } + + @Deployment(name="client-app") + public final static WebArchive createClientAppDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class) + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResourcesForNonPa(webArchive); + + return webArchive; + } + + @Test + @OperateOnDeployment("client-app") + public void testDeserialization() { + + String serializedValue = "value"; + + runtimeService.startProcessInstanceByKey("testProcess", + createVariables() + .putValueTyped("xmlSerializable", + serializedObjectValue(serializedValue) + .serializationDataFormat(SerializationDataFormats.XML) + .objectTypeName("org.camunda.bpm.integrationtest.functional.spin.XmlSerializable") + .create())); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/SpinJsonPathDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/SpinJsonPathDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..2dd76f95a7805625e3864b63468decd80f041f56 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/SpinJsonPathDelegate.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.camunda.spin.json.SpinJsonNode; + +import static org.camunda.spin.Spin.JSON; + +/** + * Created by hawky4s on 04.05.15. + */ +public class SpinJsonPathDelegate implements JavaDelegate { + + @Override + public void execute(DelegateExecution execution) throws Exception { + String json = "{\"child\": [{\"id\": 1,\"name\": \"Lucy\",\"sex\": \"female\"},{\"id\": 2,\"name\": \"Tracy\",\"sex\": \"female\"}],\"number\": 1,\"boolean\": true}"; + SpinJsonNode spinJsonNode = JSON(json).jsonPath("$.child[0]").element(); + + if (spinJsonNode == null) { + throw new RuntimeException("Unable to evalute jsonpath"); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/SpinJsonPathTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/SpinJsonPathTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5a8a066b0e20baf87ac0d23e5524f944d786d5c7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/SpinJsonPathTest.java @@ -0,0 +1,70 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import org.camunda.bpm.engine.ProcessEngineException; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.fail; + +@RunWith(Arquillian.class) +public class SpinJsonPathTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createDeployment() { + return initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/jsonpath-process.bpmn"); + } + + @Test + public void shouldEvaluateJsonPath() { + // given + String json = "{ " + + " \"foo\":[ " + + " { " + + " \"bazz\": \"hello\"," + + " \"bar\":[ " + + " 42" + + " ]" + + " }," + + " { " + + " \"bazz\": \"world\"," + + " \"bar\":[ " + + " 42" + + " ]" + + " }" + + " ]" + + "}"; + + try { + // when + runtimeService.startProcessInstanceByKey("jsonpath-process", + Variables.createVariables().putValue("data", json)); + + } catch (ProcessEngineException e) { + fail(e.getMessage()); + + } // then: no exception thrown + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/SpinVariableDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/SpinVariableDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..4f16c7aec171cc874b5bdaaa77be4a658d482069 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/SpinVariableDelegate.java @@ -0,0 +1,36 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.junit.Assert; + +/** + * @author Daniel Meyer + * + */ +public class SpinVariableDelegate implements JavaDelegate { + + public void execute(DelegateExecution execution) throws Exception { + + XmlSerializable xmlSerializable = (XmlSerializable) execution.getVariable("xmlSerializable"); + Assert.assertEquals("value", xmlSerializable.getProperty()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/XmlListSerializable.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/XmlListSerializable.java new file mode 100644 index 0000000000000000000000000000000000000000..3e61f8b6ecd9c89a9a6f38cf4e1dabd6e545e50c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/XmlListSerializable.java @@ -0,0 +1,50 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +import java.util.ArrayList; +import java.util.List; + +public class XmlListSerializable { + + private List listProperty; + + public XmlListSerializable() { + this.listProperty = new ArrayList(); + } + + public void setListProperty(List listProperty) { + this.listProperty = listProperty; + } + + public String toExpectedXmlString() { + StringBuilder jsonBuilder = new StringBuilder(); + + jsonBuilder.append(""); + for (int i = 0; i < listProperty.size(); i++) { + jsonBuilder.append("" + listProperty.get(i) + ""); + } + jsonBuilder.append(""); + + return jsonBuilder.toString(); + } + + public String toString() { + return toExpectedXmlString(); + } + +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/XmlSerializable.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/XmlSerializable.java new file mode 100644 index 0000000000000000000000000000000000000000..ec64abc3599005f9ce8ab26d85630c9514d4a57c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/XmlSerializable.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin; + +/** + * @author Daniel Meyer + * + */ +public class XmlSerializable { + + protected String property; + + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/CustomDataFormatConfigurator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/CustomDataFormatConfigurator.java new file mode 100644 index 0000000000000000000000000000000000000000..16949b306f665dd6c48af6640eea96ce331d0011 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/CustomDataFormatConfigurator.java @@ -0,0 +1,47 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin.dataformat; + +import org.camunda.bpm.integrationtest.functional.spin.XmlSerializable; +import org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat; +import org.camunda.spin.spi.DataFormatConfigurator; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; + +/** + * @author Svetlana Dorokhova. + */ +public class CustomDataFormatConfigurator implements DataFormatConfigurator { + + public CustomDataFormatConfigurator() { + } + + @Override + public Class getDataFormatClass() { + return JacksonJsonDataFormat.class; + } + + @Override + public void configure(JacksonJsonDataFormat dataFormat) { + ObjectMapper objectMapper = dataFormat.getObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addDeserializer(XmlSerializable.class, new XmlSerializableJsonDeserializer()); + module.addSerializer(XmlSerializable.class, new XmlSerializableJsonSerializer()); + objectMapper.registerModule(module); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/FailingJsonDataFormatConfigurator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/FailingJsonDataFormatConfigurator.java new file mode 100644 index 0000000000000000000000000000000000000000..0ddfb6b2fec2e9dd4fda1b1229ba0d88a1b4d0fb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/FailingJsonDataFormatConfigurator.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin.dataformat; + +import java.text.SimpleDateFormat; + +import org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat; +import org.camunda.spin.spi.DataFormatConfigurator; + +/** + * @author Thorben Lindhauer + * + */ +public class FailingJsonDataFormatConfigurator implements DataFormatConfigurator { + + public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); + + @Override + public Class getDataFormatClass() { + return JacksonJsonDataFormat.class; + } + + @Override + public void configure(JacksonJsonDataFormat dataFormat) { + throw new RuntimeException("Can't do this"); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/Foo.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/Foo.java new file mode 100644 index 0000000000000000000000000000000000000000..0cc573b6d9cc0ccfe7361dd38c9a611dbc73ae73 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/Foo.java @@ -0,0 +1,28 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin.dataformat; + +/** + * @author Thorben Lindhauer + * + */ +public class Foo { + + public String getValue() { + return "foo"; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/FooDataFormat.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/FooDataFormat.java new file mode 100644 index 0000000000000000000000000000000000000000..6f603e99f6bc8e1ea7018150541e1188151277f0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/FooDataFormat.java @@ -0,0 +1,125 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin.dataformat; + +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; +import java.util.regex.Pattern; + +import org.camunda.spin.DeserializationTypeValidator; +import org.camunda.spin.spi.DataFormat; +import org.camunda.spin.spi.DataFormatMapper; +import org.camunda.spin.spi.DataFormatReader; +import org.camunda.spin.spi.DataFormatWriter; +import org.camunda.spin.spi.TextBasedDataFormatReader; + +/** + * @author Thorben Lindhauer + * + */ +public class FooDataFormat implements DataFormat { + + public static final String TYPE_NAME = "FooType"; + public static final String NAME = "application/foo"; + + public String getName() { + return NAME; + } + + public Class getWrapperType() { + return FooSpin.class; + } + + public FooSpin createWrapperInstance(Object parameter) { + return new FooSpin(); + } + + public DataFormatReader getReader() { + return new TextBasedDataFormatReader() { + + @Override + public Object readInput(Reader reader) { + return null; + } + + @Override + protected Pattern getInputDetectionPattern() { + return Pattern.compile("foo"); + } + + }; + } + + @Override + public DataFormatWriter getWriter() { + return new DataFormatWriter() { + + @Override + public void writeToWriter(Writer writer, Object input) { + try { + writer.write("foo"); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + }; + } + + @Override + public DataFormatMapper getMapper() { + return new DataFormatMapper() { + + @Override + public Object mapJavaToInternal(Object parameter) { + return null; + } + + @Override + public T mapInternalToJava(Object parameter, String typeIdentifier) { + return mapInternalToJava(parameter, typeIdentifier, null); + } + + @Override + public T mapInternalToJava(Object parameter, String typeIdentifier, DeserializationTypeValidator validator) { + return (T) new Foo(); + } + + @Override + public T mapInternalToJava(Object parameter, Class type) { + return null; + } + + @Override + public T mapInternalToJava(Object parameter, Class type, DeserializationTypeValidator validator) { + return null; + } + + @Override + public String getCanonicalTypeName(Object object) { + return TYPE_NAME; + } + + @Override + public boolean canMap(Object parameter) { + return parameter instanceof Foo; + } + + }; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/FooDataFormatProvider.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/FooDataFormatProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..09b049ad2a7f4f70286ed11c8c9a574ed1af7f5e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/FooDataFormatProvider.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin.dataformat; + +import org.camunda.spin.spi.DataFormat; +import org.camunda.spin.spi.DataFormatProvider; + +/** + * @author Thorben Lindhauer + * + */ +public class FooDataFormatProvider implements DataFormatProvider { + + @Override + public String getDataFormatName() { + return FooDataFormat.NAME; + } + + @Override + public DataFormat createInstance() { + return new FooDataFormat(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/FooSpin.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/FooSpin.java new file mode 100644 index 0000000000000000000000000000000000000000..6494068c99d6eb97406257470c253e5067402ba1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/FooSpin.java @@ -0,0 +1,53 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin.dataformat; + +import java.io.Writer; + +import org.camunda.spin.Spin; + +/** + * @author Thorben Lindhauer + * + */ +public class FooSpin extends Spin { + + public String getDataFormatName() { + return null; + } + + public Object unwrap() { + return null; + } + + public String toString() { + return null; + } + + public void writeToWriter(Writer writer) { + + } + + public C mapTo(Class type) { + return null; + } + + public C mapTo(String type) { + return null; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/ImplicitObjectValueUpdateHandler.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/ImplicitObjectValueUpdateHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..f270dbcdde63fede048084229e96f6267cca2bb4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/ImplicitObjectValueUpdateHandler.java @@ -0,0 +1,55 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin.dataformat; + +import java.util.Date; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.DelegateTask; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.camunda.bpm.engine.delegate.TaskListener; + +/** + * @author Thorben Lindhauer + * + */ +public class ImplicitObjectValueUpdateHandler implements JavaDelegate, TaskListener { + + public static final String VARIABLE_NAME = "var"; + public static final long ONE_DAY_IN_MILLIS = 1000 * 60 * 60 * 24; + + public void execute(DelegateExecution execution) throws Exception { + JsonSerializable variable = (JsonSerializable) execution.getVariable(VARIABLE_NAME); + + addADay(variable); // implicit update, i.e. no setVariable call + + } + + public void notify(DelegateTask delegateTask) { + JsonSerializable variable = (JsonSerializable) delegateTask.getVariable(VARIABLE_NAME); + + addADay(variable); // implicit update, i.e. no setVariable call + + } + + public static void addADay(JsonSerializable jsonSerializable) { + Date newDate = new Date(jsonSerializable.getDateProperty().getTime() + ONE_DAY_IN_MILLIS); + jsonSerializable.setDateProperty(newDate); + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/JodaJsonDataFormatConfigurator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/JodaJsonDataFormatConfigurator.java new file mode 100644 index 0000000000000000000000000000000000000000..e8ed3d1f454dc7dcc089b47fbd654cdcbfcbf147 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/JodaJsonDataFormatConfigurator.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin.dataformat; + +import org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat; +import org.camunda.spin.spi.DataFormatConfigurator; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.joda.JodaModule; + +/** + * @author Thorben Lindhauer + * + */ +public class JodaJsonDataFormatConfigurator implements DataFormatConfigurator { + + @Override + public Class getDataFormatClass() { + return JacksonJsonDataFormat.class; + } + + @Override + public void configure(JacksonJsonDataFormat dataFormat) { + ObjectMapper objectMapper = dataFormat.getObjectMapper(); + + objectMapper.registerModule(new JodaModule()); + objectMapper.configure(com.fasterxml.jackson.databind.SerializationFeature. + WRITE_DATES_AS_TIMESTAMPS , false); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/JodaJsonSerializable.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/JodaJsonSerializable.java new file mode 100644 index 0000000000000000000000000000000000000000..e1d2e9f0db2d976adf8bd6bc81388bebe25d8186 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/JodaJsonSerializable.java @@ -0,0 +1,59 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin.dataformat; + +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.ISODateTimeFormat; + +/** + * @author Thorben Lindhauer + * + */ +public class JodaJsonSerializable { + + public static final long ONE_DAY_IN_MILLIS = 1000 * 60 * 60 * 24; + protected static final DateTimeFormatter DATE_TIME_FORMATTER = ISODateTimeFormat.dateTime(); + + protected DateTime dateProperty; + + public JodaJsonSerializable(DateTime dateTime) { + this.dateProperty = dateTime; + } + + public DateTime getDateProperty() { + return dateProperty; + } + + public void setDateProperty(DateTime dateTime) { + this.dateProperty = dateTime; + } + + /** + * Serializes the value as milliseconds + */ + public String toExpectedJsonString() { + StringBuilder jsonBuilder = new StringBuilder(); + + jsonBuilder.append("{\"dateProperty\":\""); + jsonBuilder.append(dateProperty.withZone(DateTimeZone.UTC).toString(DATE_TIME_FORMATTER)); + jsonBuilder.append("\"}"); + + return jsonBuilder.toString(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/JsonDataFormatConfigurator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/JsonDataFormatConfigurator.java new file mode 100644 index 0000000000000000000000000000000000000000..b3451eabcf5a51e1398d82358fe22abb0f868409 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/JsonDataFormatConfigurator.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin.dataformat; + +import java.text.SimpleDateFormat; + +import org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat; +import org.camunda.spin.spi.DataFormatConfigurator; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +/** + * @author Thorben Lindhauer + * + */ +public class JsonDataFormatConfigurator implements DataFormatConfigurator { + + public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); + + @Override + public Class getDataFormatClass() { + return JacksonJsonDataFormat.class; + } + + @Override + public void configure(JacksonJsonDataFormat dataFormat) { + ObjectMapper objectMapper = dataFormat.getObjectMapper(); + objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + objectMapper.setDateFormat(DATE_FORMAT); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/JsonSerializable.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/JsonSerializable.java new file mode 100644 index 0000000000000000000000000000000000000000..b17a1f8e2cb4210f4684d5ba11a0612a63bced98 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/JsonSerializable.java @@ -0,0 +1,98 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin.dataformat; + +import java.text.DateFormat; +import java.util.Date; + +/** + * @author Thorben Lindhauer + * + */ +public class JsonSerializable { + + public static final long ONE_DAY_IN_MILLIS = 1000 * 60 * 60 * 24; + + private Date dateProperty; + + public JsonSerializable() { + + } + + public JsonSerializable(Date dateProperty) { + this.dateProperty = dateProperty; + } + + public Date getDateProperty() { + return dateProperty; + } + + public void setDateProperty(Date dateProperty) { + this.dateProperty = dateProperty; + } + + /** + * Serializes the value according to the given date format + */ + public String toExpectedJsonString(DateFormat dateFormat) { + StringBuilder jsonBuilder = new StringBuilder(); + + jsonBuilder.append("{\"dateProperty\":\""); + jsonBuilder.append(dateFormat.format(dateProperty)); + jsonBuilder.append("\"}"); + + return jsonBuilder.toString(); + } + + /** + * Serializes the value as milliseconds + */ + public String toExpectedJsonString() { + StringBuilder jsonBuilder = new StringBuilder(); + + jsonBuilder.append("{\"dateProperty\":"); + jsonBuilder.append(Long.toString(dateProperty.getTime())); + jsonBuilder.append("}"); + + return jsonBuilder.toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((dateProperty == null) ? 0 : dateProperty.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + JsonSerializable other = (JsonSerializable) obj; + if (dateProperty == null) { + if (other.dateProperty != null) + return false; + } else if (!dateProperty.equals(other.dateProperty)) + return false; + return true; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/XmlSerializableJsonDeserializer.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/XmlSerializableJsonDeserializer.java new file mode 100644 index 0000000000000000000000000000000000000000..75644642f6166c651724310f1cf0ba8005282f9a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/XmlSerializableJsonDeserializer.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin.dataformat; + +import java.io.IOException; +import org.camunda.bpm.integrationtest.functional.spin.XmlSerializable; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; + +/** + * @author Svetlana Dorokhova. + */ +public class XmlSerializableJsonDeserializer extends JsonDeserializer { + + @Override + public XmlSerializable deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { + XmlSerializable xmlSerializable = new XmlSerializable(); + xmlSerializable.setProperty(p.getValueAsString()); + return xmlSerializable; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/XmlSerializableJsonSerializer.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/XmlSerializableJsonSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..79db8b9dfc26c33ff3599d997eae67eb84741336 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spin/dataformat/XmlSerializableJsonSerializer.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spin.dataformat; + +import java.io.IOException; +import org.camunda.bpm.integrationtest.functional.spin.XmlSerializable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +/** + * @author Svetlana Dorokhova. + */ +public class XmlSerializableJsonSerializer extends StdSerializer { + + public XmlSerializableJsonSerializer() { + super(XmlSerializable.class); + } + + @Override + public void serialize(XmlSerializable value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException { + gen.writeString(value.getProperty()); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/CustomServletProcessApplication.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/CustomServletProcessApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..7d3b5ebf9cebe9eebe61bbab0c8ec2154473f25a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/CustomServletProcessApplication.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spring; + +import org.camunda.bpm.application.ProcessApplication; + +/** + * @author Daniel Meyer + * + */ +@ProcessApplication +// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation +public class CustomServletProcessApplication extends org.camunda.bpm.application.impl.ServletProcessApplication { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/SpringExpressionResolvingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/SpringExpressionResolvingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0d8eaad5de4be04cce40341c6045c4c9dbae30fd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/SpringExpressionResolvingTest.java @@ -0,0 +1,110 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spring; + +import org.camunda.bpm.integrationtest.functional.spring.beans.ExampleBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + *

    Integration test that makes sure the shared container managed process engine is able to resolve + * Spring beans form a process application

    + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class SpringExpressionResolvingTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + + // deploy spring Process Application (does not include ejb-client nor cdi modules) + return ShrinkWrap.create(WebArchive.class, "test.war") + + // add example bean to serve as JavaDelegate + .addClass(ExampleBean.class) + // add process definitions + .addAsResource("org/camunda/bpm/integrationtest/functional/spring/SpringExpressionResolvingTest.testResolveBean.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/spring/SpringExpressionResolvingTest.testResolveBeanFromJobExecutor.bpmn20.xml") + + // add custom servlet process application + .addClass(CustomServletProcessApplication.class) + // regular deployment descriptor + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + + // web xml that bootstrapps spring + .addAsWebInfResource("org/camunda/bpm/integrationtest/functional/spring/web.xml", "web.xml") + + // spring application context & libs + .addAsWebInfResource("org/camunda/bpm/integrationtest/functional/spring/SpringExpressionResolvingTest-context.xml", "applicationContext.xml") + .addAsLibraries(DeploymentHelper.getEngineSpring()) + + // adding module dependency on process engine module (jboss only) + .addAsManifestResource("org/camunda/bpm/integrationtest/functional/spring/jboss-deployment-structure.xml", "jboss-deployment-structure.xml"); + } + + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + + // the test is deployed as a seperate deployment + + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPa(deployment); + + return deployment; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveBean() { + Assert.assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count()); + // but the process engine can: + runtimeService.startProcessInstanceByKey("testResolveBean"); + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveBeanFromJobExecutor() { + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + runtimeService.startProcessInstanceByKey("testResolveBeanFromJobExecutor"); + Assert.assertEquals(1,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/SpringPAExpressionResolvingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/SpringPAExpressionResolvingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..667f62a5f529132e198f6a7d3a45f2b7a3cb541c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/SpringPAExpressionResolvingTest.java @@ -0,0 +1,105 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spring; + +import org.camunda.bpm.integrationtest.functional.spring.beans.ExampleBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + *

    Integration test that makes sure the shared container managed process engine is able to resolve + * Spring beans form a spring process application

    + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class SpringPAExpressionResolvingTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + + // deploy spring Process Application (does not include ejb-client nor cdi modules) + return ShrinkWrap.create(WebArchive.class, "test.war") + + // add example bean to serve as JavaDelegate + .addClass(ExampleBean.class) + // add process definitions + .addAsResource("org/camunda/bpm/integrationtest/functional/spring/SpringExpressionResolvingTest.testResolveBean.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/spring/SpringExpressionResolvingTest.testResolveBeanFromJobExecutor.bpmn20.xml") + + // regular deployment descriptor + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + + // web xml that bootstrapps spring + .addAsWebInfResource("org/camunda/bpm/integrationtest/functional/spring/web.xml", "web.xml") + + // spring application context & libs + .addAsWebInfResource("org/camunda/bpm/integrationtest/functional/spring/SpringPAExpressionResolvingTest-context.xml", "applicationContext.xml") + .addAsLibraries(DeploymentHelper.getEngineSpring()); + } + + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + + // the test is deployed as a seperate deployment + + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPa(deployment); + + return deployment; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveBean() { + Assert.assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count()); + // but the process engine can: + runtimeService.startProcessInstanceByKey("testResolveBean"); + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count()); + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveBeanFromJobExecutor() { + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + runtimeService.startProcessInstanceByKey("testResolveBeanFromJobExecutor"); + Assert.assertEquals(1,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + + waitForJobExecutorToProcessAllJobs(); + + Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBeanFromJobExecutor").count()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/SpringRetryConfigurationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/SpringRetryConfigurationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a3535ac3a26fad8c0883034792b3a0162eadea08 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/SpringRetryConfigurationTest.java @@ -0,0 +1,114 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spring; + +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.JobQuery; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.spring.beans.ErrorDelegate; +import org.camunda.bpm.integrationtest.functional.spring.beans.RetryConfig; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + *

    Integration test that makes sure the shared container managed process engine is able to resolve + * Spring beans form a process application

    + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class SpringRetryConfigurationTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + + // deploy spring Process Application (does not include ejb-client nor cdi modules) + return ShrinkWrap.create(WebArchive.class, "test.war") + + // add example bean to serve as JavaDelegate + .addClass(ErrorDelegate.class) + .addClass(RetryConfig.class) + // add process definitions + .addAsResource("org/camunda/bpm/integrationtest/functional/RetryConfigurationTest.testResolveRetryConfigBean.bpmn20.xml") + + // add custom servlet process application + .addClass(CustomServletProcessApplication.class) + // regular deployment descriptor + .addAsResource("META-INF/processes.xml", "META-INF/processes.xml") + + // web xml that bootstrapps spring + .addAsWebInfResource("org/camunda/bpm/integrationtest/functional/spring/web.xml", "web.xml") + + // spring application context & libs + .addAsWebInfResource("org/camunda/bpm/integrationtest/functional/spring/SpringRetryConfigurationTest-context.xml", "applicationContext.xml") + .addAsLibraries(DeploymentHelper.getEngineSpring()) + + // adding module dependency on process engine module (jboss only) + .addAsManifestResource("org/camunda/bpm/integrationtest/functional/spring/jboss-deployment-structure.xml", "jboss-deployment-structure.xml"); + } + + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + + // the test is deployed as a seperate deployment + + WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addAsLibraries(DeploymentHelper.getEngineCdi()); + + TestContainer.addContainerSpecificResourcesForNonPa(deployment); + + return deployment; + } + + @Test + @OperateOnDeployment("clientDeployment") + public void testResolveRetryConfigBean() { + // given + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testRetry"); + + JobQuery query = managementService + .createJobQuery() + .processInstanceId(processInstance.getId()); + + Job job = query.singleResult(); + + // when job fails + try { + managementService.executeJob(job.getId()); + } catch (Exception e) { + // ignore + } + + // then + job = query.singleResult(); + Assert.assertEquals(6, job.getRetries()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/beans/ErrorDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/beans/ErrorDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..0681aad45d2bbb38dc0a6022dcbca770443d252f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/beans/ErrorDelegate.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spring.beans; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.springframework.stereotype.Component; + +@Component +public class ErrorDelegate implements JavaDelegate { + @Override + public void execute(DelegateExecution execution) throws Exception { + throw new RuntimeException("I'm supposed to fail!"); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/beans/ExampleBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/beans/ExampleBean.java new file mode 100644 index 0000000000000000000000000000000000000000..57a3f09ff0f056fa8b9aad8df8297764ec95e018 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/beans/ExampleBean.java @@ -0,0 +1,36 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spring.beans; + + +public class ExampleBean { + + protected boolean invoked; + + public void invoke() { + this.invoked = true; + } + + public boolean isInvoked() { + return invoked; + } + + public void setInvoked(boolean invoked) { + this.invoked = invoked; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/beans/RetryConfig.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/beans/RetryConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..66677561badff928c2a70cba9689d5d8bc540767 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/spring/beans/RetryConfig.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.spring.beans; + +import org.springframework.stereotype.Component; + +@Component +public class RetryConfig { + public RetryConfig() { + } + + public String defaultConfig() { + return "PT1M,PT2M,PT3M,PT4M,PT5M,PT6M"; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/AsyncJobExecutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/AsyncJobExecutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..335fe2757b5883f4839e8288959e4ed792166ec6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/AsyncJobExecutionTest.java @@ -0,0 +1,97 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.transactions; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.HashMap; + +import javax.inject.Inject; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.transactions.beans.FailingTransactionListenerDelegate; +import org.camunda.bpm.integrationtest.functional.transactions.beans.GetVersionInfoDelegate; +import org.camunda.bpm.integrationtest.functional.transactions.beans.UpdateRouterConfiguration; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class AsyncJobExecutionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(GetVersionInfoDelegate.class) + .addClass(UpdateRouterConfiguration.class) + .addClass(FailingTransactionListenerDelegate.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/transactions/AsyncJobExecutionTest.testAsyncServiceTasks.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/transactions/AsyncJobExecutionTest.failingTransactionListener.bpmn20.xml") + .addAsWebInfResource("persistence.xml", "classes/META-INF/persistence.xml"); + } + + @Inject + private RuntimeService runtimeService; + + @After + public void cleanUp() { + for (ProcessInstance processInstance : runtimeService.createProcessInstanceQuery().list()) { + runtimeService.deleteProcessInstance(processInstance.getId(), "test ended", true); + } + } + + @Test + public void shouldExecuteAsyncServiceTasks() { + // given + HashMap variables = new HashMap<>(); + variables.put("serialnumber", "23"); + runtimeService.startProcessInstanceByKey("configure-router", variables); + + // when + // all jobs are executed + waitForJobExecutorToProcessAllJobs(); + + // then + // there are no failures + } + + @Test + public void shouldFailJobWithFailingTransactionListener() throws Exception { + // given + runtimeService.startProcessInstanceByKey("failingTransactionListener"); + + // when + waitForJobExecutorToProcessAllJobs(10000); + + // then + // the job exists with no retries, and an incident is raised + Job job = managementService.createJobQuery().singleResult(); + + assertNotNull(job); + assertEquals(0, job.getRetries()); + assertNotNull(job.getExceptionMessage()); + assertNotNull(managementService.getJobExceptionStacktrace(job.getId())); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/AsyncJobExecutionWithRollbackTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/AsyncJobExecutionWithRollbackTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e97a2f69c11eb088acaa836573894117a6d7959b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/AsyncJobExecutionWithRollbackTest.java @@ -0,0 +1,100 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.transactions; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import javax.inject.Inject; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.transactions.beans.TransactionRollbackDelegate; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * This test class ensures that when a UserTransaction is explicitly marked as ROLLBACK_ONLY, + * and this code is executed within a Job, then the transaction is rolled back, and the job + * execution is marked as failed, reducing the job retries. + */ +@RunWith(Arquillian.class) +public class AsyncJobExecutionWithRollbackTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(TransactionRollbackDelegate.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/transactions/AsyncJobExecutionWithRollbackTest.transactionRollbackInServiceTask.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/transactions/AsyncJobExecutionWithRollbackTest.transactionRollbackInServiceTaskWithCustomRetryCycle.bpmn20.xml") + .addAsWebInfResource("persistence.xml", "classes/META-INF/persistence.xml"); + } + + @Inject + private RuntimeService runtimeService; + + @After + public void cleanUp() { + for (ProcessInstance processInstance : runtimeService.createProcessInstanceQuery().list()) { + runtimeService.deleteProcessInstance(processInstance.getId(), "test ended", true); + } + } + + @Test + public void shouldRollbackTransactionInServiceTask() throws Exception { + // given + runtimeService.startProcessInstanceByKey("txRollbackServiceTask"); + + // when + // the job is executed + waitForJobExecutorToProcessAllJobs(10000); + + // then + // the job exists with no retries, and an incident is raised + Job job = managementService.createJobQuery().singleResult(); + + assertNotNull(job); + assertEquals(0, job.getRetries()); + assertNotNull(job.getExceptionMessage()); + assertNotNull(managementService.getJobExceptionStacktrace(job.getId())); + } + + @Test + public void shouldRollbackTransactionInServiceTaskWithCustomRetryCycle() throws Exception { + // given + runtimeService.startProcessInstanceByKey("txRollbackServiceTaskWithCustomRetryCycle"); + + // when + waitForJobExecutorToProcessAllJobs(10000); + + // then + // the job exists with no retries, and an incident is raised + Job job = managementService.createJobQuery().singleResult(); + + assertNotNull(job); + assertEquals(0, job.getRetries()); + assertNotNull(job.getExceptionMessage()); + assertNotNull(managementService.getJobExceptionStacktrace(job.getId())); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/TransactionIntegrationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/TransactionIntegrationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d6a821b32b38088f147074120c0b0db12484d7e3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/TransactionIntegrationTest.java @@ -0,0 +1,164 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.transactions; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.functional.transactions.beans.FailingDelegate; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import javax.inject.Inject; +import javax.transaction.Status; +import javax.transaction.UserTransaction; + + +/** + *

    Checks that activiti / application transaction sharing works as expected

    + * + * @author Daniel Meyer + */ +@RunWith(Arquillian.class) +public class TransactionIntegrationTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(FailingDelegate.class) + .addAsResource("org/camunda/bpm/integrationtest/functional/transactions/TransactionIntegrationTest.testProcessFailure.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/transactions/TransactionIntegrationTest.testApplicationFailure.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/functional/transactions/TransactionIntegrationTest.testTxSuccess.bpmn20.xml") + .addAsWebInfResource("persistence.xml", "classes/META-INF/persistence.xml"); + } + + @Inject + private UserTransaction utx; + + @Inject + private RuntimeService runtimeService; + + @Test + public void testProcessFailure() throws Exception { + + /* if we start a transaction here and then start + * a process instance which synchronously invokes a java delegate, + * if that delegate fails, the transaction is marked rollback only + */ + + try { + utx.begin(); + + try { + runtimeService.startProcessInstanceByKey("testProcessFailure"); + Assert.fail("Exception expected"); + }catch (Exception ex) { + if(!(ex instanceof RuntimeException)) { + Assert.fail("Wrong exception of type "+ex+" RuntimeException expected!"); + } + if(!ex.getMessage().contains("I'm a complete failure!")) { + Assert.fail("Different message expected"); + } + } + + // assert that now our transaction is marked rollback-only: + Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, utx.getStatus()); + + } finally { + // make sure we always rollback + utx.rollback(); + } + } + + @Test + public void testApplicationFailure() throws Exception { + + /* if we start a transaction here and then successfully start + * a process instance, if our transaction is rolled back, + * the process instnace is not persisted. + */ + + try { + utx.begin(); + + String id = runtimeService.startProcessInstanceByKey("testApplicationFailure").getId(); + + // assert that the transaction is in good shape: + Assert.assertEquals(Status.STATUS_ACTIVE, utx.getStatus()); + + // now rollback the transaction (simmulating an application failure after the process engine is done). + utx.rollback(); + + utx.begin(); + + // the process instance does not exist: + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery() + .processInstanceId(id) + .singleResult(); + + Assert.assertNull(processInstance); + + utx.commit(); + }catch (Exception e) { + utx.rollback(); + throw e; + } + } + + + @Test + public void testTxSuccess() throws Exception { + + try { + utx.begin(); + + String id = runtimeService.startProcessInstanceByKey("testTxSuccess").getId(); + + // assert that the transaction is in good shape: + Assert.assertEquals(Status.STATUS_ACTIVE, utx.getStatus()); + + // the process instance is visible form our tx: + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery() + .processInstanceId(id) + .singleResult(); + + Assert.assertNotNull(processInstance); + + utx.commit(); + + utx.begin(); + + // the process instance is visible in a new tx: + processInstance = runtimeService.createProcessInstanceQuery() + .processInstanceId(id) + .singleResult(); + + Assert.assertNotNull(processInstance); + + utx.commit(); + }catch (Exception e) { + utx.rollback(); + throw e; + } + } + + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/TransactionIsolationLevelTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/TransactionIsolationLevelTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d49d49b68dc6871909ffc3b48b5b6d665b2c8552 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/TransactionIsolationLevelTest.java @@ -0,0 +1,64 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.transactions; + +import org.apache.ibatis.session.SqlSession; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import javax.inject.Inject; +import java.sql.Connection; +import java.sql.SQLException; + +import static org.camunda.bpm.integrationtest.util.TestContainer.addContainerSpecificResourcesForNonPaWithoutWeld; +import static org.junit.Assert.assertEquals; + + +@RunWith(Arquillian.class) +public class TransactionIsolationLevelTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + WebArchive archive = initWebArchiveDeployment(); + addContainerSpecificResourcesForNonPaWithoutWeld(archive); + return archive; + } + + @Inject + private ProcessEngine processEngine; + + @Test + public void testTransactionIsolationLevelOnConnection() { + ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration(); + SqlSession sqlSession = processEngineConfiguration.getDbSqlSessionFactory() + .getSqlSessionFactory() + .openSession(); + try { + int transactionIsolation = sqlSession.getConnection().getTransactionIsolation(); + assertEquals("TransactionIsolationLevel for connection is " + transactionIsolation + " instead of " + Connection.TRANSACTION_READ_COMMITTED, + Connection.TRANSACTION_READ_COMMITTED, transactionIsolation); + } catch (SQLException e) { + e.printStackTrace(); + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/TransactionListenerTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/TransactionListenerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..fb7287e87fc641c9911b24722eb8ea75a6c08406 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/TransactionListenerTest.java @@ -0,0 +1,120 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.transactions; + +import org.junit.Assert; + +import org.camunda.bpm.engine.impl.cfg.TransactionListener; +import org.camunda.bpm.engine.impl.cfg.TransactionState; +import org.camunda.bpm.engine.impl.interceptor.Command; +import org.camunda.bpm.engine.impl.interceptor.CommandContext; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TransactionListenerTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment(); + } + + @Test + public void testSynchronizationOnRollback() { + + final TestTransactionListener rolledBackListener = new TestTransactionListener(); + final TestTransactionListener committedListener = new TestTransactionListener(); + Assert.assertFalse(rolledBackListener.isInvoked()); + Assert.assertFalse(committedListener.isInvoked()); + + try { + + processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command() { + + public Void execute(CommandContext commandContext) { + commandContext.getTransactionContext().addTransactionListener(TransactionState.ROLLED_BACK, rolledBackListener); + commandContext.getTransactionContext().addTransactionListener(TransactionState.COMMITTED, committedListener); + + throw new RuntimeException("Booum! Rollback!"); + } + + }); + + }catch(Exception e) { + Assert.assertTrue(e.getMessage().contains("Rollback!")); + } + + Assert.assertTrue(rolledBackListener.isInvoked()); + Assert.assertFalse(committedListener.isInvoked()); + + } + + @Test + public void testSynchronizationOnCommitted() { + + final TestTransactionListener rolledBackListener = new TestTransactionListener(); + final TestTransactionListener committedListener = new TestTransactionListener(); + + Assert.assertFalse(rolledBackListener.isInvoked()); + Assert.assertFalse(committedListener.isInvoked()); + + try { + + processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command() { + + public Void execute(CommandContext commandContext) { + commandContext.getTransactionContext().addTransactionListener(TransactionState.ROLLED_BACK, rolledBackListener); + commandContext.getTransactionContext().addTransactionListener(TransactionState.COMMITTED, committedListener); + return null; + } + + }); + + }catch(Exception e) { + Assert.assertTrue(e.getMessage().contains("Rollback!")); + } + + Assert.assertFalse(rolledBackListener.isInvoked()); + Assert.assertTrue(committedListener.isInvoked()); + + } + + protected static class TestTransactionListener implements TransactionListener { + + protected volatile boolean invoked = false; + + public void execute(CommandContext commandContext) { + invoked = true; + } + + public boolean isInvoked() { + return invoked; + } + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/FailingDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/FailingDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..9ac52049d65db264d93d6a47751dead496897fc8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/FailingDelegate.java @@ -0,0 +1,32 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.transactions.beans; + +import javax.inject.Named; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +@Named +public class FailingDelegate implements JavaDelegate { + + @Override + public void execute(DelegateExecution execution) throws Exception { + throw new RuntimeException("I'm a complete failure!"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/FailingTransactionListenerDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/FailingTransactionListenerDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..cd8e18f5aba8381026a3405310e41ee99ab903b6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/FailingTransactionListenerDelegate.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.transactions.beans; + +import javax.inject.Named; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.camunda.bpm.engine.impl.cfg.TransactionListener; +import org.camunda.bpm.engine.impl.cfg.TransactionState; +import org.camunda.bpm.engine.impl.context.Context; +import org.camunda.bpm.engine.impl.interceptor.CommandContext; + +@Named +public class FailingTransactionListenerDelegate implements JavaDelegate { + + @Override + public void execute(DelegateExecution execution) throws Exception { + + Context.getCommandContext().getTransactionContext().addTransactionListener(TransactionState.COMMITTING, new TransactionListener() { + + @Override + public void execute(CommandContext context) { + throw new RuntimeException("exception in transaction listener"); + } + }); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/GetVersionInfoDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/GetVersionInfoDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..7649b87e15a0f25ceee1737b67270d92b78cb211 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/GetVersionInfoDelegate.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.transactions.beans; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + + +public class GetVersionInfoDelegate implements JavaDelegate { + + @Override + public void execute(DelegateExecution execution) throws Exception { + if ( !"23".equals(execution.getVariable("serialnumber"))) { + throw new Exception( "The provided router serial number is wrong. The correct serial number is 23 ;-)" ); + } + execution.setVariable("version", "2.0"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/TransactionRollbackDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/TransactionRollbackDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..a93b6cafbd9830a07429a4bdbe0b1f4c66386c9f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/TransactionRollbackDelegate.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.transactions.beans; + +import javax.inject.Inject; +import javax.inject.Named; +import javax.transaction.UserTransaction; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.camunda.bpm.engine.impl.util.EnsureUtil; + +@Named +public class TransactionRollbackDelegate implements JavaDelegate { + + @Inject + private UserTransaction utx; + + @Override + public void execute(DelegateExecution execution) throws Exception { + EnsureUtil.ensureNotNull("user transaction", utx); + + // simulate a failure that triggers the transaction rollback + utx.setRollbackOnly(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/UpdateRouterConfiguration.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/UpdateRouterConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..50b798c2d9927a079687416726b7c777fe4a2a0b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/functional/transactions/beans/UpdateRouterConfiguration.java @@ -0,0 +1,36 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.functional.transactions.beans; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + + +public class UpdateRouterConfiguration implements JavaDelegate { + + @Override + public void execute(DelegateExecution execution) throws Exception { + + String version = (String) execution.getVariable("version"); + if ("1.0".equals(version) || "2.0".equals(version)) { + System.out.println(" ### Updating router configuration..." ); + } else { + throw new Exception("Unsupported Version: " + version); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jboss/TestJobExecutorActivateFalse_JBOSS.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jboss/TestJobExecutorActivateFalse_JBOSS.java new file mode 100644 index 0000000000000000000000000000000000000000..e09d7725b011a1f8daaffebda0898780e3ce77f8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jboss/TestJobExecutorActivateFalse_JBOSS.java @@ -0,0 +1,58 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jboss; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.ProcessEngineConfiguration; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.impl.jobexecutor.JobExecutor; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestJobExecutorActivateFalse_JBOSS extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name="deployment1") + public static WebArchive processArchive() { + return initWebArchiveDeployment("test.war", "jobExecutorActivate-processes.xml"); + } + + @Test + public void shouldNotActiateJobExecutor() { + + ProcessEngine processEngine = processEngineService.getProcessEngine("jobExecutorActivate-FALSE-engine"); + ProcessEngineConfiguration configuration = processEngine.getProcessEngineConfiguration(); + JobExecutor jobExecutor = ((ProcessEngineConfigurationImpl)configuration).getJobExecutor(); + assertFalse(jobExecutor.isActive()); + + processEngine = processEngineService.getProcessEngine("jobExecutorActivate-UNDEFINED-engine"); + configuration = processEngine.getProcessEngineConfiguration(); + jobExecutor = ((ProcessEngineConfigurationImpl)configuration).getJobExecutor(); + assertTrue(jobExecutor.isActive()); + + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jboss/TestManagedDomain_JBOSS.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jboss/TestManagedDomain_JBOSS.java new file mode 100644 index 0000000000000000000000000000000000000000..02026acdee6a4149b5247b3c3785f9edf25b1ca5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jboss/TestManagedDomain_JBOSS.java @@ -0,0 +1,62 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jboss; + +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.TargetsContainer; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + *

    Ensures subsystem boots in domain mode

    + * + * @author Daniel Meyer + * @author Christian Lipphardt + * + */ +@RunWith(Arquillian.class) +public class TestManagedDomain_JBOSS { + + @Deployment @TargetsContainer("test-domain") + public static WebArchive create1() { + return ShrinkWrap.create(WebArchive.class, "test.war"); + } + + @Test + public void shouldBeAbleToLookupDefaultProcessEngine() { + try { + Assert.assertNotNull(InitialContext.doLookup("java:global/camunda-bpm-platform/process-engine/default")); + } catch (NamingException e) { + Assert.fail("Could not lookup default process engine"); + } + + try { + Assert.assertNotNull(InitialContext.doLookup("java:global/camunda-bpm-platform/process-engine/someNonExistingEngine")); + Assert.fail("Should not be able to lookup someNonExistingEngine process engine"); + } catch (NamingException e) { + // expected + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/AsyncIntermediateThrowSignalEventTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/AsyncIntermediateThrowSignalEventTest.java new file mode 100644 index 0000000000000000000000000000000000000000..98dd5cd57b5b60c964654e0ee9df47c3d90d8cda --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/AsyncIntermediateThrowSignalEventTest.java @@ -0,0 +1,60 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import static org.junit.Assert.assertEquals; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class AsyncIntermediateThrowSignalEventTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/AsyncIntermediateThrowSignalEventTest.catchAlertSignalBoundaryWithBoundarySignalEvent.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/AsyncIntermediateThrowSignalEventTest.throwAlertSignalWithIntermediateCatchSignalEvent.bpmn20.xml"); + } + + @Test + public void testAsyncSignalEvent() throws InterruptedException { + ProcessInstance piCatchSignal = runtimeService.startProcessInstanceByKey("catchSignal"); + + ProcessInstance piThrowSignal = runtimeService.startProcessInstanceByKey("throwSignal"); + + waitForJobExecutorToProcessAllJobs(); + + assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(piCatchSignal.getProcessInstanceId()).activityId("receiveTask").count()); + assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(piThrowSignal.getProcessInstanceId()).activityId("receiveTask").count()); + + // clean up + runtimeService.signal(piCatchSignal.getId()); + runtimeService.signal(piThrowSignal.getId()); + + assertEquals(0, runtimeService.createExecutionQuery().processInstanceId(piCatchSignal.getProcessInstanceId()).count()); + assertEquals(0, runtimeService.createExecutionQuery().processInstanceId(piThrowSignal.getProcessInstanceId()).count()); + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/FailedJobCommandTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/FailedJobCommandTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9577f17d8d6cb6604a7b906edb2ccd4c7a0c349f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/FailedJobCommandTest.java @@ -0,0 +1,73 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import org.camunda.bpm.integrationtest.jobexecutor.beans.FailingSLSB; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class FailedJobCommandTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive createDeployment() { + return initWebArchiveDeployment() + .addClass(FailingSLSB.class) + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/FailedJobCommandTest.bpmn20.xml"); + + } + + @Test + public void testJobRetriesDecremented() { + runtimeService.startProcessInstanceByKey("theProcess"); + + Assert.assertEquals(1, managementService.createJobQuery().withRetriesLeft().count()); + + waitForJobExecutorToProcessAllJobs(); + + // now the retries = 0 + + Assert.assertEquals(0, managementService.createJobQuery().withRetriesLeft().count()); + Assert.assertEquals(1, managementService.createJobQuery().noRetriesLeft().count()); + + } + + @Test + public void testJobRetriesDecremented_multiple() { + + for(int i = 0; i < 50; i++) { + runtimeService.startProcessInstanceByKey("theProcess"); + } + + Assert.assertEquals(50, managementService.createJobQuery().withRetriesLeft().count()); + + waitForJobExecutorToProcessAllJobs(6 * 60 * 1000); + + // now the retries = 0 + + Assert.assertEquals(0, managementService.createJobQuery().withRetriesLeft().count()); + Assert.assertEquals(51, managementService.createJobQuery().noRetriesLeft().count()); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/FailingJobBoundaryTimerWithDelegateVariablesTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/FailingJobBoundaryTimerWithDelegateVariablesTest.java new file mode 100644 index 0000000000000000000000000000000000000000..853170deea974bfed8eab48b018143ac3b37d3ad --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/FailingJobBoundaryTimerWithDelegateVariablesTest.java @@ -0,0 +1,80 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.jobexecutor.beans.DemoDelegate; +import org.camunda.bpm.integrationtest.jobexecutor.beans.DemoVariableClass; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * Test Camunda Platform container job exectuor. + * FAILING ATM! + * Expected a job with an exception but it isn't left in db with 0 retries, instead it is completely removed from the job table! + * + * @author christian.lipphardt@camunda.com + */ +@RunWith(Arquillian.class) +public class FailingJobBoundaryTimerWithDelegateVariablesTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(DemoDelegate.class) + .addClass(DemoVariableClass.class) + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/ImmediatelyFailing.bpmn20.xml"); + } + + @Test + public void testFailingJobBoundaryTimerWithDelegateVariables() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ImmediatelyFailing"); + + List jobs = managementService.createJobQuery().processInstanceId(pi.getProcessInstanceId()).list(); + assertEquals(1, jobs.size()); + assertEquals(3, jobs.get(0).getRetries()); + + assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(pi.getProcessInstanceId()).activityId("usertask1").count()); + assertEquals(2, runtimeService.createExecutionQuery().processInstanceId(pi.getProcessInstanceId()).count()); + + assertEquals(1, managementService.createJobQuery().processInstanceId(pi.getProcessInstanceId()).executable().count()); + + waitForJobExecutorToProcessAllJobs(); + + assertEquals(0, managementService.createJobQuery().processInstanceId(pi.getProcessInstanceId()).executable().count()); // should be 0, because it has failed 3 times + assertEquals(1, managementService.createJobQuery().processInstanceId(pi.getProcessInstanceId()).withException().count()); // should be 1, because job failed! + + assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(pi.getProcessInstanceId()).activityId("usertask1").count()); + assertEquals(2, runtimeService.createExecutionQuery().processInstanceId(pi.getProcessInstanceId()).count()); + + taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); // complete task with failed job => complete process + + assertEquals(0, runtimeService.createExecutionQuery().processInstanceId(pi.getProcessInstanceId()).count()); + assertEquals(0, managementService.createJobQuery().processInstanceId(pi.getProcessInstanceId()).count()); // should be 0, because process is finished. + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/IndependentJobExecutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/IndependentJobExecutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5091ad17f6a2ff7bb369abf5c67cb13daa8f0f8d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/IndependentJobExecutionTest.java @@ -0,0 +1,157 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.ProcessEngineService; +import org.camunda.bpm.application.ProcessApplicationDeploymentInfo; +import org.camunda.bpm.application.ProcessApplicationInfo; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.impl.ProcessEngineImpl; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.impl.cmd.AcquireJobsCmd; +import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; +import org.camunda.bpm.engine.impl.jobexecutor.AcquiredJobs; +import org.camunda.bpm.engine.impl.jobexecutor.JobExecutor; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.protocol.servlet.arq514hack.descriptors.api.web.WebAppDescriptor; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.jboss.shrinkwrap.descriptor.api.Descriptors; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.util.List; +import java.util.Set; + +@RunWith(Arquillian.class) +public class IndependentJobExecutionTest extends AbstractFoxPlatformIntegrationTest { + + private ProcessEngine engine1; + private ProcessEngineConfigurationImpl engine1Configuration; + + @Before + public void setEngines() { + ProcessEngineService engineService = BpmPlatform.getProcessEngineService(); + engine1 = engineService.getProcessEngine("engine1"); + engine1Configuration = ((ProcessEngineImpl) engine1).getProcessEngineConfiguration(); + } + + @Deployment(order = 0, name="pa1") + public static WebArchive processArchive1() { + + WebArchive deployment = initWebArchiveDeployment("pa1.war", "org/camunda/bpm/integrationtest/jobexecutor/IndependentJobExecutionTest.pa1.xml") + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/IndependentJobExecutionTest.process1.bpmn20.xml") + .setWebXML(new StringAsset(Descriptors.create(WebAppDescriptor.class).version("3.0").exportAsString())); + + TestContainer.addContainerSpecificProcessEngineConfigurationClass(deployment); + + return deployment; + + } + + @Deployment(order = 1, name="pa2") + public static WebArchive processArchive2() { + + return initWebArchiveDeployment("pa2.war", "org/camunda/bpm/integrationtest/jobexecutor/IndependentJobExecutionTest.pa2.xml") + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/IndependentJobExecutionTest.process2.bpmn20.xml") + .setWebXML(new StringAsset(Descriptors.create(WebAppDescriptor.class).version("3.0").exportAsString())); + } + + @OperateOnDeployment("pa1") + @Test + public void testDeploymentRegistration() { + Set registeredDeploymentsForEngine1 = engine1.getManagementService().getRegisteredDeployments(); + Set registeredDeploymentsForDefaultEngine = processEngine.getManagementService().getRegisteredDeployments(); + + ProcessApplicationInfo pa1Info = getProcessApplicationDeploymentInfo("pa1"); + + List pa1DeploymentInfo = pa1Info.getDeploymentInfo(); + + Assert.assertEquals(1, pa1DeploymentInfo.size()); + Assert.assertTrue(registeredDeploymentsForEngine1.contains(pa1DeploymentInfo.get(0).getDeploymentId())); + + ProcessApplicationInfo pa2Info = getProcessApplicationDeploymentInfo("pa2"); + + List pa2DeploymentInfo = pa2Info.getDeploymentInfo(); + Assert.assertEquals(1, pa2DeploymentInfo.size()); + Assert.assertTrue(registeredDeploymentsForDefaultEngine.contains(pa2DeploymentInfo.get(0).getDeploymentId())); + } + + private ProcessApplicationInfo getProcessApplicationDeploymentInfo(String applicationName) { + ProcessApplicationInfo processApplicationInfo = BpmPlatform.getProcessApplicationService().getProcessApplicationInfo(applicationName); + if (processApplicationInfo == null) { + processApplicationInfo = BpmPlatform.getProcessApplicationService().getProcessApplicationInfo("/" + applicationName); + } + return processApplicationInfo; + + } + + @OperateOnDeployment("pa1") + @Test + public void testDeploymentAwareJobAcquisition() { + JobExecutor jobExecutor1 = engine1Configuration.getJobExecutor(); + + ProcessInstance instance1 = engine1.getRuntimeService().startProcessInstanceByKey("archive1Process"); + ProcessInstance instance2 = processEngine.getRuntimeService().startProcessInstanceByKey("archive2Process"); + + Job job1 = managementService.createJobQuery().processInstanceId(instance1.getId()).singleResult(); + Job job2 = managementService.createJobQuery().processInstanceId(instance2.getId()).singleResult(); + + + // the deployment aware configuration should only return the jobs of the registered deployments + CommandExecutor commandExecutor = engine1Configuration.getCommandExecutorTxRequired(); + AcquiredJobs acquiredJobs = commandExecutor.execute(new AcquireJobsCmd(jobExecutor1)); + + Assert.assertEquals(1, acquiredJobs.size()); + Assert.assertTrue(acquiredJobs.contains(job1.getId())); + Assert.assertFalse(acquiredJobs.contains(job2.getId())); + } + + @OperateOnDeployment("pa1") + @Test + public void testDeploymentUnawareJobAcquisition() { + JobExecutor defaultJobExecutor = processEngineConfiguration.getJobExecutor(); + + ProcessInstance instance1 = engine1.getRuntimeService().startProcessInstanceByKey("archive1Process"); + ProcessInstance instance2 = processEngine.getRuntimeService().startProcessInstanceByKey("archive2Process"); + + Job job1 = managementService.createJobQuery().processInstanceId(instance1.getId()).singleResult(); + Job job2 = managementService.createJobQuery().processInstanceId(instance2.getId()).singleResult(); + + // the deployment unaware configuration should return both jobs + CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired(); + processEngineConfiguration.setJobExecutorDeploymentAware(false); + try { + AcquiredJobs acquiredJobs = commandExecutor.execute(new AcquireJobsCmd(defaultJobExecutor)); + + Assert.assertEquals(2, acquiredJobs.size()); + Assert.assertTrue(acquiredJobs.contains(job1.getId())); + Assert.assertTrue(acquiredJobs.contains(job2.getId())); + } finally { + processEngineConfiguration.setJobExecutorDeploymentAware(true); + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationDuringDeploymentTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationDuringDeploymentTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d0c9ffd4fc8e32fa6b13db66657f4b9a3e8b1b59 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationDuringDeploymentTest.java @@ -0,0 +1,84 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.integrationtest.jobexecutor.beans.PriorityBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit.InSequence; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Requires fix for CAM-3163 + * + * @author Thorben Lindhauer + */ +@RunWith(Arquillian.class) +@Ignore +public class JobPrioritizationDuringDeploymentTest extends AbstractFoxPlatformIntegrationTest { + + @ArquillianResource + protected Deployer deployer; + + @Override + public void setupBeforeTest() { + // don't lookup the default engine since this method is not executed in the deployment + } + + // deploy this manually + @Deployment(name="timerStart", managed = false) + public static WebArchive createTimerStartDeployment() { + return initWebArchiveDeployment() + .addClass(PriorityBean.class) + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationDuringDeploymentTest.timerStart.bpmn20.xml"); + + } + + @Test + @InSequence(1) + public void testPriorityOnTimerStartEvent() { + // when + try { + deployer.deploy("timerStart"); + + } catch (Exception e) { + e.printStackTrace(); + Assert.fail("deployment should be successful, i.e. bean for timer start event should get resolved"); + } + } + + @Test + @OperateOnDeployment("timerStart") + @InSequence(2) + public void testAssertPriority() { + + // then the timer start event job has the priority resolved from the bean + Job job = managementService.createJobQuery().activityId("timerStart").singleResult(); + + Assert.assertNotNull(job); + Assert.assertEquals(PriorityBean.PRIORITY, job.getPriority()); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationFailureJavaSerializationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationFailureJavaSerializationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..55df600a50a710940dca8e7017cc9994746478bf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationFailureJavaSerializationTest.java @@ -0,0 +1,160 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.Map; +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.ProcessEngineService; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.impl.digest._apacheCommonsCodec.Base64; +import org.camunda.bpm.engine.impl.jobexecutor.DefaultJobPriorityProvider; +import org.camunda.bpm.engine.impl.util.IoUtil; +import org.camunda.bpm.engine.impl.util.StringUtil; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats; +import org.camunda.bpm.integrationtest.jobexecutor.beans.PriorityBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class JobPrioritizationFailureJavaSerializationTest extends AbstractFoxPlatformIntegrationTest { + + protected ProcessInstance processInstance; + + private ProcessEngine engine1; + + public static final String VARIABLE_CLASS_NAME = "org.camunda.bpm.integrationtest.jobexecutor.beans.PriorityBean"; + public static final String PRIORITY_BEAN_INSTANCE_FILE = "priorityBean.instance"; + + @Before + public void setEngines() { + ProcessEngineService engineService = BpmPlatform.getProcessEngineService(); + engine1 = engineService.getProcessEngine("engine1"); + + // unregister process application so that context switch cannot be performed + unregisterProcessApplication(); + } + + protected void unregisterProcessApplication() { + org.camunda.bpm.engine.repository.Deployment deployment = + engine1.getRepositoryService().createDeploymentQuery().singleResult(); + + engine1.getManagementService().unregisterProcessApplication(deployment.getId(), false); + } + + @Deployment(order = 1) + public static WebArchive createDeployment() { + final WebArchive webArchive = initWebArchiveDeployment("paJavaSerialization1.war", "org/camunda/bpm/integrationtest/processes-javaSerializationEnabled-pa1.xml") + .addClass(PriorityBean.class) + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationTest.priorityProcess.bpmn20.xml"); + + TestContainer.addContainerSpecificProcessEngineConfigurationClass(webArchive); + return webArchive; + } + + @Deployment(name = "dummy-client", order = 2) + public static WebArchive createDummyClientDeployment() { + final WebArchive webArchive = initWebArchiveDeployment("paJavaSerialization2.war", "org/camunda/bpm/integrationtest/processes-javaSerializationEnabled-pa2.xml") + .addAsResource(new ByteArrayAsset(serializeJavaObjectValue(new PriorityBean())), PRIORITY_BEAN_INSTANCE_FILE); + return webArchive; + } + + @After + public void tearDown() { + if (processInstance != null) { + engine1.getRuntimeService().deleteProcessInstance(processInstance.getId(), ""); + } + } + + + @Test + @OperateOnDeployment("dummy-client") + public void testGracefulDegradationOnMissingBean() { + // when + processInstance = engine1.getRuntimeService().startProcessInstanceByKey("priorityProcess"); + + // then the job was created successfully and has the default priority on bean evaluation failure + Job job = engine1.getManagementService().createJobQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult(); + Assert.assertEquals(DefaultJobPriorityProvider.DEFAULT_PRIORITY_ON_RESOLUTION_FAILURE, job.getPriority()); + } + + @Test + @OperateOnDeployment("dummy-client") + public void testGracefulDegradationOnMissingClassJava() { + // given + byte[] serializedPriorityBean = readByteArrayFromClasspath(PRIORITY_BEAN_INSTANCE_FILE); + String encodedPriorityBean = StringUtil.fromBytes(Base64.encodeBase64(serializedPriorityBean), processEngine); + + Map variables = Variables.createVariables().putValue( + "priorityBean", + Variables.serializedObjectValue(encodedPriorityBean) + .serializationDataFormat(SerializationDataFormats.JAVA) + .objectTypeName(VARIABLE_CLASS_NAME) + .create()); + + // when + processInstance = engine1.getRuntimeService().startProcessInstanceByKey("priorityProcess", variables); + + // then the job was created successfully and has the default priority although + // the bean could not be resolved due to a missing class + Job job = engine1.getManagementService().createJobQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult(); + Assert.assertEquals(DefaultJobPriorityProvider.DEFAULT_PRIORITY_ON_RESOLUTION_FAILURE, job.getPriority()); + } + + protected static byte[] serializeJavaObjectValue(Serializable object) { + + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + new ObjectOutputStream(baos).writeObject(object); + return baos.toByteArray(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + protected static byte[] readByteArrayFromClasspath(String path) { + try { + InputStream inStream = JobPrioritizationFailureJavaSerializationTest.class.getClassLoader().getResourceAsStream(path); + byte[] serializedValue = IoUtil.readInputStream(inStream, ""); + inStream.close(); + return serializedValue; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationFailureTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationFailureTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4fdef3674621ba9955c556273a237c2f50d4ac17 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationFailureTest.java @@ -0,0 +1,150 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import java.io.ByteArrayOutputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.Map; +import org.camunda.bpm.engine.impl.jobexecutor.DefaultJobPriorityProvider; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats; +import org.camunda.bpm.integrationtest.jobexecutor.beans.PriorityBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class JobPrioritizationFailureTest extends AbstractFoxPlatformIntegrationTest { + + protected ProcessInstance processInstance; + + public static final String VARIABLE_CLASS_NAME = "org.camunda.bpm.integrationtest.jobexecutor.beans.PriorityBean"; + public static final String PRIORITY_BEAN_INSTANCE_FILE = "priorityBean.instance"; + + @Before + public void setEngines() { + + // unregister process application so that context switch cannot be performed + unregisterProcessApplication(); + } + + protected void unregisterProcessApplication() { + org.camunda.bpm.engine.repository.Deployment deployment = + processEngine.getRepositoryService().createDeploymentQuery().singleResult(); + + managementService.unregisterProcessApplication(deployment.getId(), false); + } + + @Deployment(order = 1) + public static WebArchive createDeployment() { + return initWebArchiveDeployment() + .addClass(PriorityBean.class) + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationTest.priorityProcess.bpmn20.xml"); + } + + @Deployment(name = "dummy-client", order = 2) + public static WebArchive createDummyClientDeployment() { + return initWebArchiveDeployment("pa2.war") + .addAsResource(new ByteArrayAsset(serializeJavaObjectValue(new PriorityBean())), PRIORITY_BEAN_INSTANCE_FILE); + } + + @After + public void tearDown() { + if (processInstance != null) { + runtimeService.deleteProcessInstance(processInstance.getId(), ""); + } + } + + + @Test + @OperateOnDeployment("dummy-client") + public void testGracefulDegradationOnMissingBean() { + // when + processInstance = runtimeService.startProcessInstanceByKey("priorityProcess"); + + // then the job was created successfully and has the default priority on bean evaluation failure + Job job = managementService.createJobQuery().singleResult(); + Assert.assertEquals(DefaultJobPriorityProvider.DEFAULT_PRIORITY_ON_RESOLUTION_FAILURE, job.getPriority()); + } + + @Test + @OperateOnDeployment("dummy-client") + public void testGracefulDegradationOnMissingClassSpinJson() { + // given + Map variables = Variables.createVariables().putValue( + "priorityBean", + Variables.serializedObjectValue("{}") + .serializationDataFormat(SerializationDataFormats.JSON) + .objectTypeName(VARIABLE_CLASS_NAME) + .create()); + + // when + processInstance = runtimeService.startProcessInstanceByKey("priorityProcess", variables); + + // then the job was created successfully and has the default priority although + // the bean could not be resolved due to a missing class + Job job = managementService.createJobQuery().singleResult(); + Assert.assertEquals(DefaultJobPriorityProvider.DEFAULT_PRIORITY_ON_RESOLUTION_FAILURE, job.getPriority()); + } + + @Test + @OperateOnDeployment("dummy-client") + public void testGracefulDegradationOnMissingClassSpinXml() { + // given + Map variables = Variables.createVariables().putValue( + "priorityBean", + Variables.serializedObjectValue("") + .serializationDataFormat(SerializationDataFormats.XML) + .objectTypeName(VARIABLE_CLASS_NAME) + .create()); + + // when + processInstance = runtimeService.startProcessInstanceByKey("priorityProcess", variables); + + // then the job was created successfully and has the default priority although + // the bean could not be resolved due to a missing class + Job job = managementService.createJobQuery().singleResult(); + Assert.assertEquals(DefaultJobPriorityProvider.DEFAULT_PRIORITY_ON_RESOLUTION_FAILURE, job.getPriority()); + } + + protected static byte[] serializeJavaObjectValue(Serializable object) { + + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + new ObjectOutputStream(baos).writeObject(object); + return baos.toByteArray(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..73345afc9998835946e14da664d5c9d3734a1b1b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationTest.java @@ -0,0 +1,143 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.runtime.TransitionInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.jobexecutor.beans.PriorityBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.After; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Thorben Lindhauer + * + */ +@RunWith(Arquillian.class) +public class JobPrioritizationTest extends AbstractFoxPlatformIntegrationTest { + + protected ProcessInstance processInstance; + + @Deployment + public static WebArchive createDeployment() { + return initWebArchiveDeployment() + .addClass(PriorityBean.class) + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationTest.priorityProcess.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationTest.serviceTask.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationTest.userTask.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/JobPrioritizationTest.intermediateMessage.bpmn20.xml"); + } + + @After + public void tearDown() { + if (processInstance != null) { + runtimeService.deleteProcessInstance(processInstance.getId(), ""); + } + } + + @Test + public void testPriorityOnProcessElement() { + // given + processInstance = runtimeService.startProcessInstanceByKey("priorityProcess"); + + Job job = managementService.createJobQuery().singleResult(); + + // then + Assert.assertEquals(PriorityBean.PRIORITY, job.getPriority()); + + } + + @Test + public void testPriorityOnProcessStart() { + + // given + processInstance = runtimeService.startProcessInstanceByKey("serviceTaskProcess"); + + Job job = managementService.createJobQuery().singleResult(); + + // then + Assert.assertEquals(PriorityBean.PRIORITY, job.getPriority()); + } + + @Test + public void testPriorityOnModification() { + + // given + processInstance = runtimeService.startProcessInstanceByKey("serviceTaskProcess"); + + TransitionInstance transitionInstance = runtimeService.getActivityInstance(processInstance.getId()) + .getTransitionInstances("serviceTask")[0]; + + // when + runtimeService.createProcessInstanceModification(processInstance.getId()) + .startBeforeActivity("serviceTask") + .cancelTransitionInstance(transitionInstance.getId()) + .execute(); + + // then + Job job = managementService.createJobQuery().singleResult(); + Assert.assertEquals(PriorityBean.PRIORITY, job.getPriority()); + } + + @Test + public void testPriorityOnInstantiationAtActivity() { + + // when + processInstance = runtimeService.createProcessInstanceByKey("serviceTaskProcess") + .startBeforeActivity("serviceTask") + .execute(); + + // then + Job job = managementService.createJobQuery().singleResult(); + Assert.assertEquals(PriorityBean.PRIORITY, job.getPriority()); + } + + @Test + public void testPriorityOnAsyncAfterUserTask() { + // given + processInstance = runtimeService.startProcessInstanceByKey("userTaskProcess"); + Task task = taskService.createTaskQuery().singleResult(); + + // when + taskService.complete(task.getId()); + + // then + Job asyncAfterJob = managementService.createJobQuery().singleResult(); + Assert.assertEquals(PriorityBean.PRIORITY, asyncAfterJob.getPriority()); + } + + @Test + public void testPriorityOnAsyncAfterIntermediateCatchEvent() { + // given + processInstance = runtimeService.startProcessInstanceByKey("intermediateMessageProcess"); + + // when + runtimeService.correlateMessage("Message"); + + // then + Job asyncAfterJob = managementService.createJobQuery().singleResult(); + Assert.assertEquals(PriorityBean.PRIORITY, asyncAfterJob.getPriority()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/ManagedJobExecutorTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/ManagedJobExecutorTest.java new file mode 100644 index 0000000000000000000000000000000000000000..71903250e2f43a1149d35f05bc8ed56e913d778e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/ManagedJobExecutorTest.java @@ -0,0 +1,150 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import static org.junit.Assert.assertEquals; + +import java.util.Timer; +import java.util.TimerTask; +import org.camunda.bpm.engine.ManagementService; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.ProcessEngineException; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.impl.jobexecutor.JobExecutor; +import org.camunda.bpm.integrationtest.jobexecutor.beans.ManagedJobExecutorBean; +import org.camunda.bpm.integrationtest.util.DeploymentHelper; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class ManagedJobExecutorTest { + + @Deployment + public static WebArchive createDeployment() { + WebArchive archive = ShrinkWrap.create(WebArchive.class, "test.war") + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addClass(ManagedJobExecutorTest.class) + .addClass(ManagedJobExecutorBean.class) + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/ManagedJobExecutorTest.testManagedExecutorUsed.bpmn20.xml"); + + TestContainer.addContainerSpecificResourcesForNonPa(archive); + + return archive; + } + + protected ProcessEngine processEngine; + protected ManagementService managementService; + protected RuntimeService runtimeService; + + @Before + public void setUpCdiProcessEngineTestCase() throws Exception { + processEngine = (ProgrammaticBeanLookup.lookup(ManagedJobExecutorBean.class)).getProcessEngine(); + managementService = processEngine.getManagementService(); + runtimeService = processEngine.getRuntimeService(); + } + + @After + public void tearDownCdiProcessEngineTestCase() throws Exception { + processEngine = null; + managementService = null; + runtimeService = null; + } + + @Test + public void testManagedExecutorUsed() throws InterruptedException { + org.camunda.bpm.engine.repository.Deployment deployment = processEngine.getRepositoryService().createDeployment() + .addClasspathResource("org/camunda/bpm/integrationtest/jobexecutor/ManagedJobExecutorTest.testManagedExecutorUsed.bpmn20.xml") + .deploy(); + + try { + String pid = runtimeService.startProcessInstanceByKey("testBusinessProcessScopedWithJobExecutor").getId(); + + assertEquals(1L, managementService.createJobQuery().processInstanceId(pid).count()); + + waitForJobExecutorToProcessAllJobs(pid, 5000l, 25l); + + assertEquals(0L, managementService.createJobQuery().processInstanceId(pid).count()); + + assertEquals("bar", runtimeService.createVariableInstanceQuery().processInstanceIdIn(pid).variableName("foo").singleResult().getValue()); + } finally { + processEngine.getRepositoryService().deleteDeployment(deployment.getId(), true); + } + + } + + protected void waitForJobExecutorToProcessAllJobs(String processInstanceId, long maxMillisToWait, long intervalMillis) { + JobExecutor jobExecutor = ((ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration()).getJobExecutor(); + jobExecutor.start(); + + try { + Timer timer = new Timer(); + InteruptTask task = new InteruptTask(Thread.currentThread()); + timer.schedule(task, maxMillisToWait); + boolean areJobsAvailable = true; + try { + while (areJobsAvailable && !task.isTimeLimitExceeded()) { + Thread.sleep(intervalMillis); + areJobsAvailable = areJobsAvailable(processInstanceId); + } + } catch (InterruptedException e) { + } finally { + timer.cancel(); + } + if (areJobsAvailable) { + throw new ProcessEngineException("time limit of " + maxMillisToWait + " was exceeded"); + } + + } finally { + jobExecutor.shutdown(); + } + } + + private static class InteruptTask extends TimerTask { + protected boolean timeLimitExceeded = false; + protected Thread thread; + public InteruptTask(Thread thread) { + this.thread = thread; + } + public boolean isTimeLimitExceeded() { + return timeLimitExceeded; + } + @Override + public void run() { + timeLimitExceeded = true; + thread.interrupt(); + } + } + + protected boolean areJobsAvailable(String processInstanceId) { + return !managementService + .createJobQuery() + .processInstanceId(processInstanceId) + .executable() + .list() + .isEmpty(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/SendSignalDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/SendSignalDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..77b7760eaee64a57fffd09bf4616f963dd7bba03 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/SendSignalDelegate.java @@ -0,0 +1,56 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import java.util.List; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.cdi.BusinessProcess; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.camunda.bpm.engine.impl.context.Context; +import org.camunda.bpm.engine.impl.interceptor.CommandContext; +import org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity; + +@Named +public class SendSignalDelegate implements JavaDelegate { + + @Inject + private RuntimeService runtimeService; + + @Inject + private BusinessProcess businessProcess; + + public void execute(DelegateExecution execution) throws Exception { + businessProcess.setVariable("processName", "throwSignal-visited (was " + businessProcess.getVariable("processName") + ")"); + + String signalProcessInstanceId = (String) execution.getVariable("signalProcessInstanceId"); + String executionId = runtimeService.createExecutionQuery().processInstanceId(signalProcessInstanceId).signalEventSubscriptionName("alert").singleResult().getId(); + + CommandContext commandContext = Context.getCommandContext(); + List findSignalEventSubscriptionsByEventName = commandContext + .getEventSubscriptionManager() + .findSignalEventSubscriptionsByNameAndExecution("alert", executionId); + + for (EventSubscriptionEntity signalEventSubscriptionEntity : findSignalEventSubscriptionsByEventName) { + signalEventSubscriptionEntity.eventReceived(null, true); + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/SetVariablesAsyncTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/SetVariablesAsyncTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2e841cc52977e88b2b844071e02324a4b5b7f551 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/SetVariablesAsyncTest.java @@ -0,0 +1,121 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import org.camunda.bpm.engine.ProcessEngineException; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.variable.Variables; +import org.camunda.bpm.integrationtest.jobexecutor.classes.MyPojo; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestContainer; +import org.camunda.bpm.model.bpmn.Bpmn; +import org.camunda.bpm.model.bpmn.BpmnModelInstance; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.ByteArrayOutputStream; +import java.util.Collections; +import java.util.List; + +import static org.junit.Assert.fail; + +@RunWith(Arquillian.class) +public class SetVariablesAsyncTest extends AbstractFoxPlatformIntegrationTest { + + public static BpmnModelInstance oneTaskProcess(String key) { + return Bpmn.createExecutableProcess(key) + .camundaHistoryTimeToLive(180) + .startEvent() + .userTask("userTask") + .endEvent() + .done(); + } + + @Deployment(name = "deployment") + public static WebArchive createDeployment() { + return initWebArchiveDeployment("deployment.war") + .addClass(MyPojo.class) + .addAsResource(modelAsAsset(oneTaskProcess("oneTaskProcess")), "oneTaskProcess.bpmn20.xml"); + } + + @Deployment(name="clientDeployment") + public static WebArchive clientDeployment() { + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "client.war") + .addClass(AbstractFoxPlatformIntegrationTest.class); + + TestContainer.addContainerSpecificResources(webArchive); + + return webArchive; + + } + + @Test + @OperateOnDeployment("clientDeployment") + public void shouldDeserializeObjectVariable() { + // given + ProcessDefinition processDefinition = repositoryService + .createProcessDefinitionQuery() + .processDefinitionKey("oneTaskProcess") + .singleResult(); + + String pi = runtimeService.startProcessInstanceById(processDefinition.getId()).getId(); + + runtimeService.setVariablesAsync(Collections.singletonList(pi), + Variables.putValue("foo", Variables.serializedObjectValue() + .objectTypeName("org.camunda.bpm.integrationtest.functional.context.classes.MyPojo") + .serializedValue("{\"name\": \"myName\", \"prio\": 5}") + .serializationDataFormat("application/json") + .create())); + + // execute seed jobs + List jobs = managementService.createJobQuery().list(); + for (Job job : jobs) { + managementService.executeJob(job.getId()); + } + + // when: execute remaining batch jobs + jobs = managementService.createJobQuery().list(); + for (Job job : jobs) { + try { + managementService.executeJob(job.getId()); + } catch (ProcessEngineException ex) { + fail("No exception expected: " + ex.getMessage()); + } + } + + // then + Assert.assertNotNull(runtimeService.getVariableTyped(pi, "foo", false)); + } + + protected static Asset modelAsAsset(BpmnModelInstance modelInstance) { + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + Bpmn.writeModelToStream(byteStream, modelInstance); + + byte[] bytes = byteStream.toByteArray(); + return new ByteArrayAsset(bytes); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/SignalEventCatchBoundaryWithVariablesTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/SignalEventCatchBoundaryWithVariablesTest.java new file mode 100644 index 0000000000000000000000000000000000000000..25370cd4b12c1cae149b263db3b3786f09e1dcba --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/SignalEventCatchBoundaryWithVariablesTest.java @@ -0,0 +1,73 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import static org.junit.Assert.assertEquals; + +import java.util.HashMap; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class SignalEventCatchBoundaryWithVariablesTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + return initWebArchiveDeployment() + .addClass(SendSignalDelegate.class) + .addClass(SignalReceivedDelegate.class) + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/SignalEventCatchBoundaryWithVariablesTest.catchAlertSignalBoundaryWithReceiveTask.bpmn20.xml") + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/SignalEventCatchBoundaryWithVariablesTest.throwAlertSignalWithDelegate.bpmn20.xml"); + } + + @Test + public void testSignalCatchBoundaryWithVariables() throws InterruptedException { + HashMap variables1 = new HashMap(); + variables1.put("processName", "catchSignal"); + ProcessInstance piCatchSignal = runtimeService.startProcessInstanceByKey("catchSignal", variables1); + + HashMap variables2 = new HashMap(); + variables2.put("processName", "throwSignal"); + variables2.put("signalProcessInstanceId", piCatchSignal.getProcessInstanceId()); + ProcessInstance piThrowSignal = runtimeService.startProcessInstanceByKey("throwSignal", variables2); + + waitForJobExecutorToProcessAllJobs(); + + assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(piCatchSignal.getProcessInstanceId()).activityId("receiveTask").count()); + assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(piThrowSignal.getProcessInstanceId()).activityId("receiveTask").count()); + + // TODO: THis fails because of http://jira.codehaus.org/browse/ACT-1257, + // should be fixed and re-enabled :-) + assertEquals("catchSignal-visited (was catchSignal)", runtimeService.getVariable(piCatchSignal.getId(), "processName")); + assertEquals("throwSignal-visited (was throwSignal)", runtimeService.getVariable(piThrowSignal.getId(), "processName")); + + // clean up + runtimeService.signal(piCatchSignal.getId()); + runtimeService.signal(piThrowSignal.getId()); + + assertEquals(0, runtimeService.createExecutionQuery().processInstanceId(piCatchSignal.getProcessInstanceId()).count()); + assertEquals(0, runtimeService.createExecutionQuery().processInstanceId(piThrowSignal.getProcessInstanceId()).count()); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/SignalReceivedDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/SignalReceivedDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..63e2b6c4b1cc066d1b9e9592e45701b1a2e6b78e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/SignalReceivedDelegate.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.camunda.bpm.engine.cdi.BusinessProcess; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + + +@Named +public class SignalReceivedDelegate implements JavaDelegate { + + @Inject + private BusinessProcess businessProcess; + + public void execute(DelegateExecution execution) { + businessProcess.setVariable("processName", "catchSignal-visited (was " + businessProcess.getVariable("processName") + ")"); +// log.log(Level.INFO, ""); + } +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/TimeoutTaskListenerExecutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/TimeoutTaskListenerExecutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3fa86eb9f6a2addd1684e9008d71491ea9a26bf8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/TimeoutTaskListenerExecutionTest.java @@ -0,0 +1,62 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import java.util.List; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.task.Task; +import org.camunda.bpm.integrationtest.jobexecutor.beans.SampleTaskListenerBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class TimeoutTaskListenerExecutionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + WebArchive archive = initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/TimeoutTaskListenerExecution.bpmn20.xml") + .addClass(SampleTaskListenerBean.class); + + return archive; + } + + @Test + public void testProcessExecution() { + + ProcessInstance instance = runtimeService.startProcessInstanceByKey("process"); + + waitForJobExecutorToProcessAllJobs(); + + List finallyRunningInstances = runtimeService.createProcessInstanceQuery().processInstanceId(instance.getId()).list(); + Assert.assertEquals(1, finallyRunningInstances.size()); + + Task task = taskService.createTaskQuery().processInstanceId(instance.getId()).singleResult(); + Assert.assertNotNull(task); + + Object variable = taskService.getVariable(task.getId(), "called"); + Assert.assertNotNull(variable); + + Assert.assertTrue((boolean) variable); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/TimerExecutionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/TimerExecutionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..344d8e6561473826c2ff04acca53c4ea7f2a6693 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/TimerExecutionTest.java @@ -0,0 +1,58 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import java.util.List; + +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.integrationtest.jobexecutor.beans.SampleServiceBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * + * @author nico.rehwaldt + */ +@RunWith(Arquillian.class) +public class TimerExecutionTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + WebArchive archive = initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/TimerExecution.bpmn20.xml") + .addClass(SampleServiceBean.class); + + return archive; + } + + @Test + public void testProcessExecution() { + + ProcessInstance instance = runtimeService.startProcessInstanceByKey("TimerExecutionProcess"); + + waitForJobExecutorToProcessAllJobs(); + + List finallyRunningInstances = runtimeService.createProcessInstanceQuery().processInstanceId(instance.getId()).list(); + Assert.assertEquals(0, finallyRunningInstances.size()); + + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/TimerRecalculationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/TimerRecalculationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..853b916fc75116f0666647007fff533833b1d471 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/TimerRecalculationTest.java @@ -0,0 +1,89 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.runtime.JobQuery; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.runtime.ProcessInstanceQuery; +import org.camunda.bpm.integrationtest.jobexecutor.beans.TimerExpressionBean; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * + * @author Tobias Metzke + */ +@RunWith(Arquillian.class) +public class TimerRecalculationTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive processArchive() { + WebArchive archive = initWebArchiveDeployment() + .addAsResource("org/camunda/bpm/integrationtest/jobexecutor/TimerRecalculation.bpmn20.xml") + .addClass(TimerExpressionBean.class); + + return archive; + } + + @Test + public void testTimerRecalculationBasedOnProcessVariable() { + // given + Map variables = new HashMap<>(); + variables.put("timerExpression", "PT10S"); + ProcessInstance instance = runtimeService.startProcessInstanceByKey("TimerRecalculationProcess", variables); + + ProcessInstanceQuery instancesQuery = runtimeService.createProcessInstanceQuery().processInstanceId(instance.getId()); + JobQuery jobQuery = managementService.createJobQuery(); + assertEquals(1, instancesQuery.count()); + assertEquals(1, jobQuery.count()); + + Job job = jobQuery.singleResult(); + Date oldDueDate = job.getDuedate(); + + // when + runtimeService.setVariable(instance.getId(), "timerExpression", "PT1S"); + managementService.recalculateJobDuedate(job.getId(), true); + + // then + assertEquals(1, jobQuery.count()); + Job jobRecalculated = jobQuery.singleResult(); + assertNotEquals(oldDueDate, jobRecalculated.getDuedate()); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(jobRecalculated.getCreateTime()); + calendar.add(Calendar.SECOND, 1); + Date expectedDate = calendar.getTime(); + assertEquals(expectedDate, jobRecalculated.getDuedate()); + + waitForJobExecutorToProcessAllJobs(); + + assertEquals(0, instancesQuery.count()); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/DemoDelegate.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/DemoDelegate.java new file mode 100644 index 0000000000000000000000000000000000000000..d6628a035ee9bd5b8ed9cf53e6d7c7302f348bcd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/DemoDelegate.java @@ -0,0 +1,116 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor.beans; + +import java.util.Date; +import java.util.HashMap; +import java.util.Random; +import java.util.logging.Logger; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.Expression; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +public class DemoDelegate implements JavaDelegate { + + Logger log = Logger.getLogger(DemoDelegate.class.getName()); + Expression fail; + DelegateExecution execution; + + @Override + public void execute(DelegateExecution execution) throws Exception { + this.execution = execution; + + log.info("Do Something."); + + insertVariable("stringVar", "Demo-Value"); + insertVariable("longVar", 1L); + insertVariable("longObjectVar", Long.valueOf(1)); + insertVariable("intVar", 1); + insertVariable("intObjectVar", Integer.valueOf(1)); + insertVariable("shortVar", (short) 1); + insertVariable("shortObjectVar", Short.valueOf("1")); + insertVariable("byteVar", (byte) 1); + insertVariable("byteObjectVar", Byte.valueOf("1")); + insertVariable("booleanVar", true); + insertVariable("booleanObjectVar", Boolean.TRUE); + insertVariable("floatVar", 1.5f); + insertVariable("floatObjectVar", Float.valueOf(1.5f)); + insertVariable("doubleVar", 1.5d); + insertVariable("doubleObjectVar", Double.valueOf(1.5d)); + insertVariable("charVar", 'a'); + insertVariable("charObjectVar", Character.valueOf('a')); + insertVariable("dateObjectVar", new Date()); + insertVariable("nullable", null); + insertVariable("random", Double.valueOf(Math.random() * 100).intValue()); + + char[] charArray = {'a','b','c','D'}; + insertVariable("charArrayVar", charArray); + Character[] characterObjectArray = { Character.valueOf('a'), Character.valueOf('b'), Character.valueOf('c'), Character.valueOf('D') }; + insertVariable("characterObjectArray", characterObjectArray); + + String byteString = "mycooltextcontentasbyteyesyes!!!"; + insertVariable("byteArrayVar", byteString.getBytes("UTF-8")); + Byte[] ByteArray = new Byte[byteString.length()]; + byte[] bytes = byteString.getBytes("UTF-8"); + + for (int i = 0; i < bytes.length; i++) { + byte b = bytes[i]; + ByteArray[i] = Byte.valueOf(b); + } + insertVariable("ByteArrayVariable", ByteArray); + + DemoVariableClass demoVariableClass = new DemoVariableClass(); + + demoVariableClass.setBooleanObjectProperty(Boolean.valueOf(true)); + demoVariableClass.setBooleanProperty(false); + demoVariableClass.setByteObjectProperty(Byte.valueOf(Byte.MAX_VALUE)); + demoVariableClass.setCharProperty('z'); + demoVariableClass.setDoubleObjectProperty(Double.valueOf(2.25d)); + demoVariableClass.setDoubleProperty(1.75d); + demoVariableClass.setFloatObjectProperty(Float.valueOf(4.34f)); + demoVariableClass.setFloatProperty(100.005f); + demoVariableClass.setIntArrayProperty(new int[]{1,2,3}); + demoVariableClass.setIntegerObjectProperty(null); + demoVariableClass.setIntProperty(-10); + demoVariableClass.setLongObjectProperty(Long.valueOf(Long.MIN_VALUE)); + demoVariableClass.setLongProperty(Long.MAX_VALUE); + + HashMap demoHashMap= new HashMap(); + demoHashMap.put("key1", "value1"); + demoHashMap.put("key2", "value2"); + demoVariableClass.setMapProperty(demoHashMap); + + demoVariableClass.setShortObjectProperty(Short.valueOf(Short.MAX_VALUE)); + demoVariableClass.setShortProperty(Short.MIN_VALUE); + demoVariableClass.setStringProperty("cockpit rulez"); + + insertVariable("demoVariableClass", demoVariableClass); + + if (null != fail) { + String failString = (String) fail.getValue(execution); + if (null != failString && failString.equals("true")) { + log.info("I'm failing now!."); + throw new RuntimeException("I'm supposed to fail" + new Random().nextInt(5)); + } + } + } + + private void insertVariable(String varName, Object value) { + execution.setVariable(varName + Double.valueOf(Math.random() * 10).intValue(), value); + } +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/DemoVariableClass.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/DemoVariableClass.java new file mode 100644 index 0000000000000000000000000000000000000000..b87aa4388feeccf67f7492735097cacd83e79f80 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/DemoVariableClass.java @@ -0,0 +1,191 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor.beans; + + +import java.io.Serializable; +import java.util.Map; + +public class DemoVariableClass implements Serializable { + + private static final long serialVersionUID = 1L; + private boolean booleanProperty; + private byte byteProperty; + private short shortProperty; + private int intProperty; + private long longProperty; + private float floatProperty; + private double doubleProperty; + private char charProperty; + + private Boolean booleanObjectProperty; + private Byte byteObjectProperty; + private Short shortObjectProperty; + private Integer integerObjectProperty; + private Long longObjectProperty; + private Float floatObjectProperty; + private Double doubleObjectProperty; + + private String stringProperty; + private int[] intArrayProperty; + private Map mapProperty; + + public boolean isBooleanProperty() { + return booleanProperty; + } + + public void setBooleanProperty(boolean booleanProperty) { + this.booleanProperty = booleanProperty; + } + + public byte getByteProperty() { + return byteProperty; + } + + public void setByteProperty(byte byteProperty) { + this.byteProperty = byteProperty; + } + + public short getShortProperty() { + return shortProperty; + } + + public void setShortProperty(short shortProperty) { + this.shortProperty = shortProperty; + } + + public int getIntProperty() { + return intProperty; + } + + public void setIntProperty(int intProperty) { + this.intProperty = intProperty; + } + + public long getLongProperty() { + return longProperty; + } + + public void setLongProperty(long longProperty) { + this.longProperty = longProperty; + } + + public float getFloatProperty() { + return floatProperty; + } + + public void setFloatProperty(float floatProperty) { + this.floatProperty = floatProperty; + } + + public double getDoubleProperty() { + return doubleProperty; + } + + public void setDoubleProperty(double doubleProperty) { + this.doubleProperty = doubleProperty; + } + + public char getCharProperty() { + return charProperty; + } + + public void setCharProperty(char charProperty) { + this.charProperty = charProperty; + } + + public Boolean getBooleanObjectProperty() { + return booleanObjectProperty; + } + + public void setBooleanObjectProperty(Boolean booleanObjectProperty) { + this.booleanObjectProperty = booleanObjectProperty; + } + + public Byte getByteObjectProperty() { + return byteObjectProperty; + } + + public void setByteObjectProperty(Byte byteObjectProperty) { + this.byteObjectProperty = byteObjectProperty; + } + + public Short getShortObjectProperty() { + return shortObjectProperty; + } + + public void setShortObjectProperty(Short shortObjectProperty) { + this.shortObjectProperty = shortObjectProperty; + } + + public Integer getIntegerObjectProperty() { + return integerObjectProperty; + } + + public void setIntegerObjectProperty(Integer integerObjectProperty) { + this.integerObjectProperty = integerObjectProperty; + } + + public Long getLongObjectProperty() { + return longObjectProperty; + } + + public void setLongObjectProperty(Long longObjectProperty) { + this.longObjectProperty = longObjectProperty; + } + + public Float getFloatObjectProperty() { + return floatObjectProperty; + } + + public void setFloatObjectProperty(Float floatObjectProperty) { + this.floatObjectProperty = floatObjectProperty; + } + + public Double getDoubleObjectProperty() { + return doubleObjectProperty; + } + + public void setDoubleObjectProperty(Double doubleObjectProperty) { + this.doubleObjectProperty = doubleObjectProperty; + } + + public String getStringProperty() { + return stringProperty; + } + + public void setStringProperty(String stringProperty) { + this.stringProperty = stringProperty; + } + + public int[] getIntArrayProperty() { + return intArrayProperty; + } + + public void setIntArrayProperty(int[] intArrayProperty) { + this.intArrayProperty = intArrayProperty; + } + + public Map getMapProperty() { + return mapProperty; + } + + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/FailingSLSB.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/FailingSLSB.java new file mode 100644 index 0000000000000000000000000000000000000000..91149c72230a08f07768914b46d41afab367c0e6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/FailingSLSB.java @@ -0,0 +1,36 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor.beans; + +import javax.ejb.Stateless; +import javax.inject.Named; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +@Named +@Stateless +public class FailingSLSB implements JavaDelegate { + + public void execute(DelegateExecution execution) { + + // throw an unexpected exception + throw new RuntimeException("I am failing"); + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/ManagedJobExecutorBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/ManagedJobExecutorBean.java new file mode 100644 index 0000000000000000000000000000000000000000..48c06d41ad0745c20c068bc3d5c92d105aacc156 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/ManagedJobExecutorBean.java @@ -0,0 +1,63 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor.beans; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.annotation.Resource; +import javax.ejb.Singleton; +import javax.ejb.Startup; +import javax.enterprise.concurrent.ManagedExecutorService; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.cdi.impl.ManagedJobExecutor; + +@Startup +@Singleton +public class ManagedJobExecutorBean { + + @Resource + private ManagedExecutorService managedExecutorService; + + protected ProcessEngine processEngine; + protected ManagedJobExecutor jobExecutor; + + @PostConstruct + public void startEngine() { + // Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation + org.camunda.bpm.engine.impl.cfg.JtaProcessEngineConfiguration processEngineConfiguration = + new org.camunda.bpm.engine.impl.cfg.JtaProcessEngineConfiguration(); + processEngineConfiguration.setDatabaseSchemaUpdate("true") + .setHistory("auto") + .setDbMetricsReporterActivate(false) + .setDataSourceJndiName("java:jboss/datasources/ProcessEngine"); + processEngineConfiguration.setTransactionManagerJndiName("java:/TransactionManager"); + jobExecutor = new ManagedJobExecutor(managedExecutorService); + processEngine = processEngineConfiguration + .setJobExecutor(jobExecutor) + .buildProcessEngine(); + } + + @PreDestroy + public void stopEngine() { + processEngine.close(); + jobExecutor.shutdown(); + } + + public ProcessEngine getProcessEngine() { + return processEngine; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/PriorityBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/PriorityBean.java new file mode 100644 index 0000000000000000000000000000000000000000..c4b74be73e2a6faa01e88d7bea633d556909ad58 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/PriorityBean.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor.beans; + +import java.io.Serializable; + +import javax.ejb.Stateless; +import javax.inject.Named; + +/** + * @author Thorben Lindhauer + * + */ +@Named +@Stateless +public class PriorityBean implements Serializable { + + private static final long serialVersionUID = 1L; + + public static final int PRIORITY = 52; + + public int getPriority() { + return PRIORITY; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/SampleServiceBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/SampleServiceBean.java new file mode 100644 index 0000000000000000000000000000000000000000..ef16ca70615ac2c17056aef4307e396197bcec96 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/SampleServiceBean.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor.beans; + +import javax.enterprise.context.ApplicationScoped; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +/** + * + * @author nico.rehwaldt + */ +@ApplicationScoped +public class SampleServiceBean implements JavaDelegate { + + private boolean called = false; + + @Override + public void execute(DelegateExecution execution) throws Exception { + called = true; + } + + public boolean isCalled() { + return called; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/SampleTaskListenerBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/SampleTaskListenerBean.java new file mode 100644 index 0000000000000000000000000000000000000000..bcb532e734f13320908c6dbb1773cb62eb301af8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/SampleTaskListenerBean.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor.beans; + +import org.camunda.bpm.engine.delegate.DelegateTask; +import org.camunda.bpm.engine.delegate.TaskListener; + +public class SampleTaskListenerBean implements TaskListener { + + @Override + public void notify(DelegateTask delegateTask) { + delegateTask.setVariable("called", true); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/TimerExpressionBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/TimerExpressionBean.java new file mode 100644 index 0000000000000000000000000000000000000000..3d574f7e492d7a247e15211717ab66ab29771e2e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/beans/TimerExpressionBean.java @@ -0,0 +1,65 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor.beans; + +import java.io.Serializable; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.cdi.annotation.ProcessVariableTyped; +import org.camunda.bpm.engine.exception.NullValueException; +import org.camunda.bpm.engine.runtime.VariableInstance; +import org.camunda.bpm.engine.variable.value.StringValue; +import org.camunda.bpm.engine.variable.value.TypedValue; + +/** + * @author Tobias Metzke + * + */ +@Named +public class TimerExpressionBean implements Serializable { + + private static final long serialVersionUID = 1L; + + @Inject + @ProcessVariableTyped(value="timerExpression") + private TypedValue timerExpression; + + @Inject + RuntimeService runtimeService; + + public String getTimerDuration() { + if (timerExpression == null) { + VariableInstance variable = runtimeService + .createVariableInstanceQuery() + .variableName("timerExpression") + .singleResult(); + if (variable != null) { + timerExpression = variable.getTypedValue(); + } + } + if (timerExpression == null) { + throw new NullValueException("no variable 'timerExpression' found"); + } + if (timerExpression instanceof StringValue) { + return ((StringValue) timerExpression).getValue(); + } + return String.valueOf(timerExpression.getValue()); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/classes/MyPojo.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/classes/MyPojo.java new file mode 100644 index 0000000000000000000000000000000000000000..2efd93317af08962ab6c02fc9c644e658e79121d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/jobexecutor/classes/MyPojo.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.jobexecutor.classes; + +public class MyPojo { + + public MyPojo() { + } + + public String name; + public int prio; + + public String getName() { + return name; + } + + public int getPrio() { + return prio; + } + + public void setName(String name) { + this.name = name; + } + + public void setPrio(int prio) { + this.prio = prio; + } + + } \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/service/PlatformServicesJndiBindingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/service/PlatformServicesJndiBindingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a55e42314b754e20b42cdc114f0d79f3bc7d20b1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/service/PlatformServicesJndiBindingTest.java @@ -0,0 +1,59 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.service; + +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.camunda.bpm.integrationtest.util.TestConstants; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class PlatformServicesJndiBindingTest extends AbstractFoxPlatformIntegrationTest { + + protected TestConstants testConstants = new TestConstants(); + + @Deployment + public static WebArchive app1() { + return initWebArchiveDeployment(); + } + + @Test + public void testProcessApplicationServiceBinding() { + try { + InitialContext.doLookup(testConstants.getProcessApplicationService()); + } catch (NamingException e) { + Assert.fail("Failed to lookup ProcessApplicationService '" + TestConstants.PROCESS_APPLICATION_SERVICE_JNDI_NAME + "'. Reason: " + e); + } + } + + @Test + public void testProcessEngineServiceBinding() { + try { + InitialContext.doLookup(testConstants.getEngineService()); + } catch (NamingException e) { + Assert.fail("Failed to lookup ProcessEngineService '" + TestConstants.PROCESS_ENGINE_SERVICE_JNDI_NAME + "'. Reason: " + e); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/service/ProcessApplicationServiceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/service/ProcessApplicationServiceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f2fc5cf02adf072c9f9ed46535f2a2577bc4d744 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/service/ProcessApplicationServiceTest.java @@ -0,0 +1,78 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.service; + +import java.util.Arrays; +import java.util.Set; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.ProcessApplicationService; +import org.camunda.bpm.application.ProcessApplicationInfo; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + + +/** + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class ProcessApplicationServiceTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name="test1") + public static WebArchive app1() { + return initWebArchiveDeployment("test1.war") + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml"); + } + + @Deployment(name="test2") + public static WebArchive app2() { + return initWebArchiveDeployment("test2.war") + .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchiveWithoutActivitiCdi.bpmn20.xml"); + } + + @Test + @OperateOnDeployment("test1") + public void testProcessApplicationsDeployed() { + + ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService(); + + Set processApplicationNames = processApplicationService.getProcessApplicationNames(); + + // check if the new applications are deployed with allowed names + processApplicationNames.retainAll(Arrays.asList(new String [] {"test1", "test2", "/test1", "/test2"})); + + Assert.assertEquals(2, processApplicationNames.size()); + + for (String appName : processApplicationNames) { + ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(appName); + + Assert.assertNotNull(processApplicationInfo); + Assert.assertNotNull(processApplicationInfo.getName()); + Assert.assertEquals(1, processApplicationInfo.getDeploymentInfo().size()); + } + + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/service/ProcessEngineServiceTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/service/ProcessEngineServiceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2434c5f6e8bd51bf02116efb0209fd48889015fe --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/service/ProcessEngineServiceTest.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.service; + +import org.junit.Assert; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.ProcessEngineService; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.OperateOnDeployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @author Thorben Lindhauer + */ +@RunWith(Arquillian.class) +public class ProcessEngineServiceTest extends AbstractFoxPlatformIntegrationTest { + + @Deployment(name="test1") + public static WebArchive app1() { + return initWebArchiveDeployment("test1.war"); + } + + @Test + @OperateOnDeployment("test1") + public void testNonExistingEngineRetrieval() { + + ProcessEngineService engineService = BpmPlatform.getProcessEngineService(); + ProcessEngine engine = engineService.getProcessEngine("aNonExistingEngineName"); + Assert.assertNull(engine); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/service/TestProcessEngineJndiBinding_JBOSS.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/service/TestProcessEngineJndiBinding_JBOSS.java new file mode 100644 index 0000000000000000000000000000000000000000..b696b76feb19e30d493968bfcb406559784f4ca9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/service/TestProcessEngineJndiBinding_JBOSS.java @@ -0,0 +1,60 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.service; + +import javax.naming.InitialContext; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + *

    Makes sure that the process engine JNDI bindings are created

    + * + * @author Daniel Meyer + * + */ +@RunWith(Arquillian.class) +public class TestProcessEngineJndiBinding_JBOSS extends AbstractFoxPlatformIntegrationTest { + + @Deployment + public static WebArchive app1() { + return initWebArchiveDeployment(); + } + + @Test + public void testDefaultProcessEngineBindingCreated() { + + try { + ProcessEngine processEngine = InitialContext.doLookup("java:global/camunda-bpm-platform/process-engine/default"); + Assert.assertNotNull("Process engine must not be null", processEngine); + + } catch(Exception e) { + Assert.fail("Process Engine not bound in JNDI."); + + } + + } + + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/util/AbstractDeploymentHelper.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/util/AbstractDeploymentHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..8570273555d0a79d0ee5a9da27504c8c599f2b9d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/util/AbstractDeploymentHelper.java @@ -0,0 +1,172 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.resolver.api.maven.Maven; +import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; +import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenDependencies; +import org.jboss.shrinkwrap.resolver.api.maven.strategy.RejectDependenciesStrategy; + + +public abstract class AbstractDeploymentHelper { + + protected static JavaArchive CACHED_CLIENT_ASSET; + protected static JavaArchive CACHED_ENGINE_CDI_ASSET; + protected static JavaArchive[] CACHED_WELD_ASSETS; + protected static JavaArchive[] CACHED_SPRING_ASSETS; + + protected static JavaArchive getEjbClient(String ejbClientArtifactName) { + if(CACHED_CLIENT_ASSET != null) { + return CACHED_CLIENT_ASSET; + } else { + + JavaArchive[] resolvedArchives = Maven.configureResolver() + .workOffline() + .loadPomFromFile("pom.xml") + .resolve(ejbClientArtifactName) + .withTransitivity() + .as(JavaArchive.class); + + if(resolvedArchives.length == 0) { + throw new RuntimeException("could not resolve "+ ejbClientArtifactName); + } else { + CACHED_CLIENT_ASSET = resolvedArchives[0]; + return CACHED_CLIENT_ASSET; + } + } + + } + + protected static JavaArchive getEngineCdi(String engineCdiArtifactName) { + if(CACHED_ENGINE_CDI_ASSET != null) { + return CACHED_ENGINE_CDI_ASSET; + } else { + + JavaArchive[] resolvedArchives = Maven.configureResolver() + .workOffline() + .loadPomFromFile("pom.xml") + .resolve(engineCdiArtifactName) + .withTransitivity() + .as(JavaArchive.class); + + if(resolvedArchives.length == 0) { + throw new RuntimeException("could not resolve "+ engineCdiArtifactName); + } else { + CACHED_ENGINE_CDI_ASSET = resolvedArchives[0]; + return CACHED_ENGINE_CDI_ASSET; + } + } + } + + protected static JavaArchive[] getWeld(String engineCdiArtifactName) { + if(CACHED_WELD_ASSETS != null) { + return CACHED_WELD_ASSETS; + } else { + + JavaArchive[] resolvedArchives = Maven.configureResolver() + .workOffline() + .loadPomFromFile("pom.xml") + .resolve(engineCdiArtifactName, "org.jboss.weld.servlet:weld-servlet") + .withTransitivity() + .as(JavaArchive.class); + + if(resolvedArchives.length == 0) { + throw new RuntimeException("could not resolve org.jboss.weld.servlet:weld-servlet"); + } else { + CACHED_WELD_ASSETS = resolvedArchives; + return CACHED_WELD_ASSETS; + } + } + + } + + protected static JavaArchive[] getEngineSpring(String engineSpringArtifactName) { + if(CACHED_SPRING_ASSETS != null) { + return CACHED_SPRING_ASSETS; + } else { + + JavaArchive[] resolvedArchives = Maven.configureResolver() + .workOffline() + .loadPomFromFile("pom.xml") + .addDependencies( + MavenDependencies.createDependency(engineSpringArtifactName, ScopeType.COMPILE, false, + MavenDependencies.createExclusion("org.camunda.bpm:camunda-engine")), + MavenDependencies.createDependency("org.springframework:spring-context", ScopeType.COMPILE, false), + MavenDependencies.createDependency("org.springframework:spring-jdbc", ScopeType.COMPILE, false), + MavenDependencies.createDependency("org.springframework:spring-tx", ScopeType.COMPILE, false), + MavenDependencies.createDependency("org.springframework:spring-orm", ScopeType.COMPILE, false), + MavenDependencies.createDependency("org.springframework:spring-web", ScopeType.COMPILE, false)) + .resolve() + .withTransitivity() + .as(JavaArchive.class); + + if(resolvedArchives.length == 0) { + throw new RuntimeException("could not resolve " + engineSpringArtifactName); + } else { + CACHED_SPRING_ASSETS = resolvedArchives; + return CACHED_SPRING_ASSETS; + } + } + + } + + public static JavaArchive[] getJodaTimeModuleForServer(String server) { + if (server.equals("tomcat") || + server.equals("weblogic") || + server.equals("glassfish")) { + return Maven.configureResolver() + .workOffline() + .loadPomFromFile("pom.xml") + .resolve("com.fasterxml.jackson.datatype:jackson-datatype-joda") + .using(new RejectDependenciesStrategy(false, + "joda-time:joda-time")) + .as(JavaArchive.class); + } else if (server.equals("jboss")) { + return Maven.configureResolver() + .workOffline() + .loadPomFromFile("pom.xml") + .resolve("com.fasterxml.jackson.datatype:jackson-datatype-joda") + .using(new RejectDependenciesStrategy(false, + "com.fasterxml.jackson.core:jackson-annotations", + "com.fasterxml.jackson.core:jackson-core", + "com.fasterxml.jackson.core:jackson-databind")) + .as(JavaArchive.class); + } else { + throw new RuntimeException("Unable to determine dependencies for jodaTimeModule: " + server); + } + } + + public static JavaArchive[] getSpinJacksonJsonDataFormatForServer(String server) { + if (server.equals("tomcat") || + server.equals("weblogic") || + server.equals("glassfish")) { + return Maven.configureResolver() + .workOffline() + .loadPomFromFile("pom.xml") + .resolve("org.camunda.spin:camunda-spin-dataformat-json-jackson") + .using(new RejectDependenciesStrategy(false, + "org.camunda.spin:camunda-spin-core", + "org.camunda.commons:camunda-commons-logging", + "org.camunda.commons:camunda-commons-utils")) + .as(JavaArchive.class); + } else { + throw new RuntimeException("Unable to determine dependencies for spinJacksonJsonDataFormat: " + server); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/util/AbstractFoxPlatformIntegrationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/util/AbstractFoxPlatformIntegrationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..20b08423fd9d489319a313114b7799ca4d8b73b4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/util/AbstractFoxPlatformIntegrationTest.java @@ -0,0 +1,186 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.ProcessEngineService; +import org.camunda.bpm.engine.CaseService; +import org.camunda.bpm.engine.DecisionService; +import org.camunda.bpm.engine.FormService; +import org.camunda.bpm.engine.HistoryService; +import org.camunda.bpm.engine.IdentityService; +import org.camunda.bpm.engine.ManagementService; +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.TaskService; +import org.camunda.bpm.engine.impl.ProcessEngineImpl; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.impl.jobexecutor.JobExecutor; +import org.camunda.bpm.engine.impl.util.ClockUtil; +import org.camunda.bpm.engine.runtime.Job; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Before; + +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; +import java.util.logging.Logger; + + +public abstract class AbstractFoxPlatformIntegrationTest { + + protected static final long JOBS_WAIT_TIMEOUT_MS = 20_000L; + + protected Logger logger = Logger.getLogger(AbstractFoxPlatformIntegrationTest.class.getName()); + + protected ProcessEngineService processEngineService; +// protected ProcessArchiveService processArchiveService; + protected ProcessEngine processEngine; + protected ProcessEngineConfigurationImpl processEngineConfiguration; + protected FormService formService; + protected HistoryService historyService; + protected IdentityService identityService; + protected ManagementService managementService; + protected RepositoryService repositoryService; + protected RuntimeService runtimeService; + protected TaskService taskService; + protected CaseService caseService; + protected DecisionService decisionService; + + public static WebArchive initWebArchiveDeployment(String name, String processesXmlPath) { + WebArchive archive = ShrinkWrap.create(WebArchive.class, name) + .addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml") + .addAsLibraries(DeploymentHelper.getEngineCdi()) + .addAsResource(processesXmlPath, "META-INF/processes.xml") + .addClass(AbstractFoxPlatformIntegrationTest.class) + .addClass(TestConstants.class); + + TestContainer.addContainerSpecificResources(archive); + + return archive; + } + public static WebArchive initWebArchiveDeployment(String name) { + return initWebArchiveDeployment(name, "META-INF/processes.xml"); + } + + public static WebArchive initWebArchiveDeployment() { + return initWebArchiveDeployment("test.war"); + } + + + + @Before + public void setupBeforeTest() { + processEngineService = BpmPlatform.getProcessEngineService(); + processEngine = processEngineService.getDefaultProcessEngine(); + processEngineConfiguration = ((ProcessEngineImpl)processEngine).getProcessEngineConfiguration(); + processEngineConfiguration.getJobExecutor().shutdown(); // make sure the job executor is down + formService = processEngine.getFormService(); + historyService = processEngine.getHistoryService(); + identityService = processEngine.getIdentityService(); + managementService = processEngine.getManagementService(); + repositoryService = processEngine.getRepositoryService(); + runtimeService = processEngine.getRuntimeService(); + taskService = processEngine.getTaskService(); + caseService = processEngine.getCaseService(); + decisionService = processEngine.getDecisionService(); + } + + public void waitForJobExecutorToProcessAllJobs() { + waitForJobExecutorToProcessAllJobs(JOBS_WAIT_TIMEOUT_MS); + } + + public void waitForJobExecutorToProcessAllJobs(long maxMillisToWait) { + + JobExecutor jobExecutor = processEngineConfiguration.getJobExecutor(); + waitForJobExecutorToProcessAllJobs(jobExecutor, maxMillisToWait); + } + + public void waitForJobExecutorToProcessAllJobs(JobExecutor jobExecutor, long maxMillisToWait) { + + int checkInterval = 1000; + + jobExecutor.start(); + + try { + Timer timer = new Timer(); + InterruptTask task = new InterruptTask(Thread.currentThread()); + timer.schedule(task, maxMillisToWait); + boolean areJobsAvailable = true; + try { + while (areJobsAvailable && !task.isTimeLimitExceeded()) { + Thread.sleep(checkInterval); + areJobsAvailable = areJobsAvailable(); + } + } catch (InterruptedException e) { + } finally { + timer.cancel(); + } + if (areJobsAvailable) { + throw new RuntimeException("time limit of " + maxMillisToWait + " was exceeded (still " + numberOfJobsAvailable() + " jobs available)"); + } + + } finally { + jobExecutor.shutdown(); + } + } + + public boolean areJobsAvailable() { + List list = managementService.createJobQuery().list(); + for (Job job : list) { + if (isJobAvailable(job)) { + return true; + } + } + return false; + } + + public boolean isJobAvailable(Job job) { + return job.getRetries() > 0 && (job.getDuedate() == null || ClockUtil.getCurrentTime().after(job.getDuedate())); + } + + public int numberOfJobsAvailable() { + int numberOfJobs = 0; + List jobs = managementService.createJobQuery().list(); + for (Job job : jobs) { + if (isJobAvailable(job)) { + numberOfJobs++; + } + } + return numberOfJobs; + } + + private static class InterruptTask extends TimerTask { + + protected boolean timeLimitExceeded = false; + protected Thread thread; + + public InterruptTask(Thread thread) { + this.thread = thread; + } + public boolean isTimeLimitExceeded() { + return timeLimitExceeded; + } + public void run() { + timeLimitExceeded = true; + thread.interrupt(); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/util/DeploymentHelper.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/util/DeploymentHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..5022ca52519d4ac378812d7d2b537051e05042d5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/util/DeploymentHelper.java @@ -0,0 +1,42 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.jboss.shrinkwrap.api.spec.JavaArchive; + +public class DeploymentHelper extends AbstractDeploymentHelper { + + protected static final String CAMUNDA_EJB_CLIENT = "org.camunda.bpm.javaee:camunda-ejb-client"; + protected static final String CAMUNDA_ENGINE_CDI = "org.camunda.bpm:camunda-engine-cdi"; + protected static final String CAMUNDA_ENGINE_SPRING = "org.camunda.bpm:camunda-engine-spring"; + + public static JavaArchive getEjbClient() { + return getEjbClient(CAMUNDA_EJB_CLIENT); + } + + public static JavaArchive getEngineCdi() { + return getEngineCdi(CAMUNDA_ENGINE_CDI); + } + + public static JavaArchive[] getWeld() { + return getWeld(CAMUNDA_ENGINE_CDI); + } + + public static JavaArchive[] getEngineSpring() { + return getEngineSpring(CAMUNDA_ENGINE_SPRING); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/util/TestHelper.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/util/TestHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..772b5a9ca730db9f3938fde95df082f53063d3a8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/java/org/camunda/bpm/integrationtest/util/TestHelper.java @@ -0,0 +1,131 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; 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. + */ +package org.camunda.bpm.integrationtest.util; + +import org.camunda.bpm.engine.ProcessEngine; +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.cdi.impl.util.ProgrammaticBeanLookup; +import org.camunda.bpm.engine.impl.util.IoUtil; +import org.camunda.bpm.engine.repository.ProcessDefinition; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; +import org.junit.Assert; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; + +import static org.junit.Assert.*; + + +public abstract class TestHelper { + + public final static String PROCESS_XML = + ""; + + public static Asset getStringAsAssetWithReplacements(String string, String[][] replacements) { + + for (String[] replacement : replacements) { + string = string.replaceAll(replacement[0], replacement[1]); + } + + return new ByteArrayAsset(string.getBytes()); + + } + + public static Asset[] generateProcessAssets(int amount) { + + Asset[] result = new Asset[amount]; + + for (int i = 0; i < result.length; i++) { + result[i] = getStringAsAssetWithReplacements(PROCESS_XML, new String[][]{new String[]{"PROCESS_KEY","process-"+i}}); + } + + return result; + + } + + public static void assertDiagramIsDeployed(boolean deployed, Class clazz, String expectedDiagramResource, String processDefinitionKey) throws IOException { + ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class); + Assert.assertNotNull(processEngine); + RepositoryService repositoryService = processEngine.getRepositoryService(); + ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey(processDefinitionKey) + .singleResult(); + assertNotNull(processDefinition); + + InputStream actualStream = null; + InputStream expectedStream = null; + try { + actualStream = repositoryService.getProcessDiagram(processDefinition.getId()); + + if (deployed) { + byte[] actualDiagram = IoUtil.readInputStream(actualStream, "actualStream"); + assertNotNull(actualDiagram); + assertTrue(actualDiagram.length > 0); + + expectedStream = clazz.getResourceAsStream(expectedDiagramResource); + byte[] expectedDiagram = IoUtil.readInputStream(expectedStream, "expectedSteam"); + assertNotNull(expectedDiagram); + + assertTrue(isEqual(expectedStream, actualStream)); + } else { + assertNull(actualStream); + } + } finally { + IoUtil.closeSilently(actualStream); + IoUtil.closeSilently(expectedStream); + } + } + + protected static boolean isEqual(InputStream stream1, InputStream stream2) + throws IOException { + + ReadableByteChannel channel1 = Channels.newChannel(stream1); + ReadableByteChannel channel2 = Channels.newChannel(stream2); + + ByteBuffer buffer1 = ByteBuffer.allocateDirect(1024); + ByteBuffer buffer2 = ByteBuffer.allocateDirect(1024); + + try { + while (true) { + + int bytesReadFromStream1 = channel1.read(buffer1); + int bytesReadFromStream2 = channel2.read(buffer2); + + if (bytesReadFromStream1 == -1 || bytesReadFromStream2 == -1) return bytesReadFromStream1 == bytesReadFromStream2; + + buffer1.flip(); + buffer2.flip(); + + for (int i = 0; i < Math.min(bytesReadFromStream1, bytesReadFromStream2); i++) + if (buffer1.get() != buffer2.get()) + return false; + + buffer1.compact(); + buffer2.compact(); + } + + } finally { + if (stream1 != null) stream1.close(); + if (stream2 != null) stream2.close(); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/resources/META-INF/empty_processes.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/resources/META-INF/empty_processes.xml new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/resources/META-INF/processes.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/resources/META-INF/processes.xml new file mode 100644 index 0000000000000000000000000000000000000000..ae6726afb5109cbe2eb93474711e85717bac50a7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/resources/META-INF/processes.xml @@ -0,0 +1,14 @@ + + + + + + true + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/resources/META-INF/scan_for_definitions_processes.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/resources/META-INF/scan_for_definitions_processes.xml new file mode 100644 index 0000000000000000000000000000000000000000..c27ad95dae5c53e2968ecaa97280ef97b1831c71 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/qa/integration-tests-engine/src/test/resources/META-INF/scan_for_definitions_processes.xml @@ -0,0 +1,14 @@ + + + + + default + + true + true + + + + \ No newline at end of file