Commit e04a6804 authored by Romain Bioteau's avatar Romain Bioteau

BS-10234

parent e09ddb9e
......@@ -468,4 +468,11 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.bonitasoft.studio.contract"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>
......@@ -147,6 +147,39 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="elements" upperBound="-1"
eType="#//Element" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Contract">
<eStructuralFeatures xsi:type="ecore:EReference" name="inputs" upperBound="-1"
eType="#//ContractInput" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="constraints" upperBound="-1"
eType="#//ContractConstraint" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ContractInput">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="#//ContractInputType"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="multiple" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
defaultValueLiteral="false"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="mandatory" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
defaultValueLiteral="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ContractConstraint">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="expression" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="errorMessage" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="inputNames" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" defaultValueLiteral=""/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="ContractInputType">
<eLiterals name="TEXT"/>
<eLiterals name="INTEGER" value="1"/>
<eLiterals name="DECIMAL" value="2"/>
<eLiterals name="BOOLEAN" value="3"/>
<eLiterals name="DATE" value="4"/>
<eLiterals name="COMPLEX" value="5"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ContractComplexInput" eSuperTypes="#//ContractInput">
<eStructuralFeatures xsi:type="ecore:EReference" name="inputs" upperBound="-1"
eType="#//ContractInput" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Correlation">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="correlationType" lowerBound="1"
eType="#//CorrelationTypeActive" defaultValueLiteral="INACTIVE"/>
......@@ -524,6 +557,8 @@
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" defaultValueLiteral="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="priority" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
defaultValueLiteral="2"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="contract" eType="#//Contract"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TextAnnotation" eSuperTypes="#//Element">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="text" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
......
......@@ -422,6 +422,14 @@
<genEnumLiterals ecoreEnumLiteral="process.ecore#//ConsultationPageFlowType/PAGEFLOW"/>
<genEnumLiterals ecoreEnumLiteral="process.ecore#//ConsultationPageFlowType/REDIRECTION"/>
</genEnums>
<genEnums typeSafeEnumCompatible="false" ecoreEnum="process.ecore#//ContractInputType">
<genEnumLiterals ecoreEnumLiteral="process.ecore#//ContractInputType/TEXT"/>
<genEnumLiterals ecoreEnumLiteral="process.ecore#//ContractInputType/INTEGER"/>
<genEnumLiterals ecoreEnumLiteral="process.ecore#//ContractInputType/DECIMAL"/>
<genEnumLiterals ecoreEnumLiteral="process.ecore#//ContractInputType/BOOLEAN"/>
<genEnumLiterals ecoreEnumLiteral="process.ecore#//ContractInputType/DATE"/>
<genEnumLiterals ecoreEnumLiteral="process.ecore#//ContractInputType/COMPLEX"/>
</genEnums>
<genEnums typeSafeEnumCompatible="false" ecoreEnum="process.ecore#//CorrelationTypeActive">
<genEnumLiterals ecoreEnumLiteral="process.ecore#//CorrelationTypeActive/INACTIVE"/>
<genEnumLiterals ecoreEnumLiteral="process.ecore#//CorrelationTypeActive/KEYS"/>
......@@ -551,6 +559,25 @@
<genClasses ecoreClass="process.ecore#//Container">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference process.ecore#//Container/elements"/>
</genClasses>
<genClasses ecoreClass="process.ecore#//Contract">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference process.ecore#//Contract/inputs"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference process.ecore#//Contract/constraints"/>
</genClasses>
<genClasses ecoreClass="process.ecore#//ContractInput">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//ContractInput/name"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//ContractInput/type"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//ContractInput/description"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//ContractInput/multiple"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//ContractInput/mandatory"/>
</genClasses>
<genClasses ecoreClass="process.ecore#//ContractConstraint">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//ContractConstraint/expression"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//ContractConstraint/errorMessage"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//ContractConstraint/inputNames"/>
</genClasses>
<genClasses ecoreClass="process.ecore#//ContractComplexInput">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference process.ecore#//ContractComplexInput/inputs"/>
</genClasses>
<genClasses ecoreClass="process.ecore#//Correlation">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//Correlation/correlationType"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference process.ecore#//Correlation/correlationAssociation"/>
......@@ -767,6 +794,7 @@
<genClasses ecoreClass="process.ecore#//Task">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//Task/overrideActorsOfTheLane"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//Task/priority"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference process.ecore#//Task/contract"/>
</genClasses>
<genClasses ecoreClass="process.ecore#//TextAnnotation">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute process.ecore#//TextAnnotation/text"/>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -343,6 +343,15 @@
body="return org.bonitasoft.studio.common.emf.tools.ExpressionHelper.createExpression(&quot;multiInstanceIterator&quot;,&quot;multiInstanceIterator&quot;,org.bonitasoft.studio.common.ExpressionConstants.MULTIINSTANCE_ITERATOR_TYPE,Object.class.getName(),false);"
language="java"/>
</initializers>
<initializers
xsi:type="gmfmap:FeatureValueSpec">
<feature
xsi:type="ecore:EReference"
href="process.ecore#//Task/contract"/>
<value
body="return org.bonitasoft.studio.model.process.ProcessFactory.eINSTANCE.createContract();"
language="java"/>
</initializers>
</domainInitializer>
<labelMappings
xsi:type="gmfmap:FeatureLabelMapping">
......
......@@ -9,7 +9,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.ui,
org.eclipse.emf.transaction;bundle-version="1.3.0",
org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.2.0",
org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.2.0";visibility:=reexport,
org.eclipse.gmf.runtime.diagram.ui.resources.editor;bundle-version="1.2.0",
org.eclipse.jdt.core,
org.eclipse.jdt.launching,
......@@ -23,14 +23,14 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jdt.ui,
org.eclipse.core.filesystem,
org.eclipse.wst.xml.ui,
org.eclipse.core.databinding;bundle-version="1.2.0",
org.eclipse.jface.databinding;bundle-version="1.3.1",
org.eclipse.emf.databinding;bundle-version="1.1.0",
org.eclipse.emf.databinding.edit;bundle-version="1.1.0",
org.eclipse.core.databinding;bundle-version="1.2.0";visibility:=reexport,
org.eclipse.jface.databinding;bundle-version="1.3.1";visibility:=reexport,
org.eclipse.emf.databinding;bundle-version="1.1.0";visibility:=reexport,
org.eclipse.emf.databinding.edit;bundle-version="1.1.0";visibility:=reexport,
org.bonitasoft.studio.pics;bundle-version="1.0.0",
org.eclipse.ui.intro;bundle-version="3.3.1",
com.ibm.icu;bundle-version="4.2.1",
org.eclipse.core.databinding.property;bundle-version="1.3.0",
org.eclipse.core.databinding.property;bundle-version="1.3.0";visibility:=reexport,
org.eclipse.ui.ide;bundle-version="3.6.0",
org.eclipse.ui.browser;bundle-version="3.3.0",
org.eclipse.e4.ui.workbench,
......
......@@ -20,7 +20,7 @@ package org.bonitasoft.studio.common;
public class ModelVersion {
public static final String VERSION_6_0_0_ALPHA = "6.0.0-Alpha";
public static final String CURRENT_VERSION = "6.4.0-001";
public static final String CURRENT_VERSION = "6.4.0-002";
public static boolean sameVersion(final String version) {
return CURRENT_VERSION.equals(version);
......
......@@ -5,18 +5,17 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.common.jface;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.StyledCellLabelProvider;
......@@ -33,7 +32,6 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;
public abstract class AbstractCheckboxLabelProvider extends StyledCellLabelProvider implements ILabelProvider {
......@@ -45,7 +43,7 @@ public abstract class AbstractCheckboxLabelProvider extends StyledCellLabelProvi
protected static final String DISABLED_UNCHECKED_KEY = "uncheckKeyDisabled";
public AbstractCheckboxLabelProvider(Control control) {
public AbstractCheckboxLabelProvider(final Control control) {
if (control != null) {
if (JFaceResources.getImageRegistry().getDescriptor(UNCHECK_KEY) == null) {
JFaceResources.getImageRegistry().put(UNCHECK_KEY,
......@@ -71,7 +69,7 @@ public abstract class AbstractCheckboxLabelProvider extends StyledCellLabelProvi
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
*/
@Override
public Image getImage(Object element) {
public Image getImage(final Object element) {
if (isSelected(element)) {
if (isEnabled(element)) {
return JFaceResources.getImage(CHECKED_KEY);
......@@ -88,37 +86,32 @@ public abstract class AbstractCheckboxLabelProvider extends StyledCellLabelProvi
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
*/
@Override
public String getText(Object element) {
public String getText(final Object element) {
return ((Boolean) isSelected(element)).toString();
}
protected abstract boolean isSelected(Object element);
protected boolean isEnabled(Object element) {
protected boolean isEnabled(final Object element) {
return true;
}
private Image makeShot(Control control, boolean type, boolean enabled) {
private Image makeShot(final Control control, final boolean type, final boolean enabled) {
// Hopefully no platform uses exactly this color because we'll make
// it transparent in the image.
Color greenScreen = new Color(control.getDisplay(), 222, 223, 224);
final Color greenScreen = new Color(control.getDisplay(), 222, 223, 224);
final Shell shell = new Shell(control.getShell(), SWT.NO_TRIM);
Shell shell = new Shell(control.getShell(), SWT.NO_TRIM);
shell.setVisible(false);
shell.setLocation(0, 0);
// otherwise we have a default gray color
shell.setBackground(greenScreen);
Button button = new Button(shell, SWT.CHECK);
final Button button = new Button(shell, SWT.CHECK);
button.setBackground(greenScreen);
button.setSelection(type);
if (!enabled) {
button.setEnabled(false);
}
// otherwise an image is located in a corner
button.setLocation(1, 1);
Point bsize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT);
final Point bsize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT);
// otherwise an image is stretched by width
bsize.x = Math.max(bsize.x - 1, bsize.y - 1);
......@@ -127,45 +120,56 @@ public abstract class AbstractCheckboxLabelProvider extends StyledCellLabelProvi
shell.setSize(bsize);
shell.open();
GC gc = new GC(shell);
Image image = new Image(control.getDisplay(), bsize.x, bsize.y);
final GC gc = new GC(shell);
final Image image = new Image(control.getDisplay(), bsize.x, bsize.y);
gc.copyArea(image, 0, 0);
gc.dispose();
shell.close();
ImageData imageData = image.getImageData();
imageData.transparentPixel = imageData.palette.getPixel(greenScreen
.getRGB());
final ImageData imageData = image.getImageData();
imageData.transparentPixel = imageData.palette.getPixel(greenScreen.getRGB());
return new Image(control.getDisplay(), imageData);
}
@Override
protected void paint(Event event, Object element) {
super.paint(event, element);
Image image = getImage(element);
if (image == null) {
return;
}
Widget item = event.item;
Rectangle bounds = null;
if (item instanceof TreeItem) {
bounds = ((TreeItem) item).getBounds(event.index);
} else if (item instanceof TableItem) {
bounds = ((TableItem) item).getBounds(event.index);
}
Rectangle imgBounds = image.getBounds();
bounds.width /= 2;
bounds.width -= imgBounds.width / 2;
bounds.height /= 2;
bounds.height -= imgBounds.height / 2;
int x = bounds.width > 0 ? bounds.x + bounds.width : bounds.x;
int y = bounds.height > 0 ? bounds.y + bounds.height : bounds.y;
if (!Platform.OS_WIN32.equals(Platform.getOS())) {
y = y - 3;
protected void paint(final Event event, final Object element) {
final Image img = getImage(element);
if (img != null) {
Rectangle bounds;
if (event.item instanceof TableItem) {
bounds = ((TableItem) event.item).getBounds(event.index);
} else {
bounds = ((TreeItem) event.item).getBounds(event.index);
}
final Rectangle imgBounds = img.getBounds();
bounds.width /= 2;
bounds.width -= imgBounds.width / 2;
bounds.height /= 2;
bounds.height -= imgBounds.height / 2;
final int x = bounds.width > 0 ? bounds.x + bounds.width : bounds.x;
final int y = bounds.height > 0 ? bounds.y + bounds.height : bounds.y;
if (SWT.getPlatform().equals("carbon")) {
event.gc.drawImage(img, x + 2, y - 1);
} else {
event.gc.drawImage(img, x, y - 1);
}
}
event.gc.drawImage(image, x, y);
}
@Override
protected void measure(final Event event, final Object element) {
event.height = getImage(element).getBounds().height;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-test/java"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.bonitasoft.studio.contract</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Contract Plugin
Bundle-Localization: plugin
Bundle-SymbolicName: org.bonitasoft.studio.contract;singleton:=true
Bundle-Version: 6.4.0.qualifier
Bundle-Vendor: Bonitasoft S.A.
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.0",
org.eclipse.ui;bundle-version="3.105.0",
org.bonitasoft.studio.model;bundle-version="6.4.0",
org.bonitasoft.studio.common;bundle-version="6.4.0",
org.junit;bundle-version="4.11.0";resolution:=optional,
assertj-core;bundle-version="1.5.0";resolution:=optional,
org.mockito;bundle-version="1.9.5";resolution:=optional
Bundle-Activator: org.bonitasoft.studio.contract.ContractPlugin
Bundle-ActivationPolicy: lazy
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
plugin.properties,\
messages.properties
src.excludes = src-test/java/
contractSectionDescription=Define a contract for this step.
name=Name
type=Type
mandatory=Mandatory
multiple=Multiple
add=Add
remove=Remove
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
<propertyTabs
contributorId="org.bonitasoft.studio.diagram">
<propertyTab
afterTab="tab.actors"
category="domain"
id="tab.contract"
label="%tab.contract.label">
</propertyTab>
</propertyTabs>
</extension>
<extension
point="org.eclipse.ui.views.properties.tabbed.propertySections">
<propertySections
contributorId="org.bonitasoft.studio.diagram">
<propertySection
class="org.bonitasoft.studio.contract.ui.property.ContractPropertySection"
enablesFor="1"
filter="org.bonitasoft.studio.contract.ui.property.TaskFilter"
id="ContractSection"
tab="tab.contract"
viewID="org.bonitasoft.studio.views.properties.process.general">
</propertySection>
</propertySections>
</extension>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.bonitasoft.studio.bundles</groupId>
<artifactId>plugins</artifactId>
<version>6.4.0-SNAPSHOT</version>
</parent>
<groupId>org.bonitasoft.studio.bundles.plugins</groupId>
<artifactId>org.bonitasoft.studio.contract</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
/**
* Copyright (C) 2014 BonitaSoft S.A.
* BonitaSoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.contract.ui.property;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* @author Romain Bioteau
*
*/
public class ContractPropertySectionTest {
private ContractPropertySection section;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
section = new ContractPropertySection();
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}
@Test
public void section_description_isNotEmpty() throws Exception {
assertThat(section.getSectionDescription()).isNotEmpty();
}
}
package org.bonitasoft.studio.contract.ui.property;
import static org.assertj.core.api.Assertions.assertThat;
import org.bonitasoft.studio.model.process.ContractInput;
import org.bonitasoft.studio.model.process.ProcessFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class MandatoryInputCheckboxLabelProviderTest {
private MandatoryInputCheckboxLabelProvider labelProviderUnderTest;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
labelProviderUnderTest = new MandatoryInputCheckboxLabelProvider(null);
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}
@Test
public void shouldIsSelected_ReturnsFalse() throws Exception {
assertThat(labelProviderUnderTest.isSelected(null)).isFalse();
final ContractInput optionalInput = ProcessFactory.eINSTANCE.createContractInput();
optionalInput.setMandatory(false);
assertThat(labelProviderUnderTest.isSelected(optionalInput)).isFalse();
}
@Test
public void shouldIsSelected_ReturnsTrue() throws Exception {
final ContractInput mandatoryInput = ProcessFactory.eINSTANCE.createContractInput();
mandatoryInput.setMandatory(true);
assertThat(labelProviderUnderTest.isSelected(mandatoryInput)).isTrue();
}
}
package org.bonitasoft.studio.contract.ui.property;
import static org.assertj.core.api.Assertions.assertThat;
import org.bonitasoft.studio.model.process.ContractInput;
import org.bonitasoft.studio.model.process.ProcessFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class MultipleInputCheckboxLabelProviderTest {
private MultipleInputCheckboxLabelProvider labelProviderUnderTest;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
labelProviderUnderTest = new MultipleInputCheckboxLabelProvider(null);
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}
@Test
public void shouldIsSelected_ReturnsFalseFor_Single_ContractInput() throws Exception {
assertThat(labelProviderUnderTest.isSelected(null)).isFalse();
final ContractInput optionalInput = ProcessFactory.eINSTANCE.createContractInput();
optionalInput.setMultiple(false);
assertThat(labelProviderUnderTest.isSelected(optionalInput)).isFalse();
}
@Test
public void shouldIsSelected_ReturnsTrue_For_Multiple_ContractInput() throws Exception {
final ContractInput optionalInput = ProcessFactory.eINSTANCE.createContractInput();
optionalInput.setMultiple(true);
assertThat(labelProviderUnderTest.isSelected(optionalInput)).isTrue();
}
}
/**
* Copyright (C) 2014 BonitaSoft S.A.
* BonitaSoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.contract.ui.property;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
import org.bonitasoft.studio.model.process.ProcessFactory;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;