Search in sources :

Example 1 with IProperty

use of com.archimatetool.model.IProperty in project archi by archimatetool.

the class PropertiesModelDataSourceTests method runOnceBeforeEachTest.

@Before
public void runOnceBeforeEachTest() {
    model = IArchimateFactory.eINSTANCE.createArchimateModel();
    IProperty property = IArchimateFactory.eINSTANCE.createProperty();
    property.setKey("key1");
    property.setValue("value1");
    model.getProperties().add(property);
    property = IArchimateFactory.eINSTANCE.createProperty();
    property.setKey("key2");
    property.setValue("value2");
    model.getProperties().add(property);
    ds = new PropertiesModelDataSource(model);
}
Also used : IProperty(com.archimatetool.model.IProperty) Before(org.junit.Before)

Example 2 with IProperty

use of com.archimatetool.model.IProperty in project archi by archimatetool.

the class CommonTests method testProperties.

public static void testProperties(IProperties properties) {
    testList(properties.getProperties(), IArchimatePackage.eINSTANCE.getProperty());
    String key = "some_key", value = "some_value";
    IProperty property = IArchimateFactory.eINSTANCE.createProperty();
    property.setKey(key);
    property.setValue(value);
    properties.getProperties().add(property);
    // Check entry is correct
    EList<IProperty> entries = properties.getProperties();
    assertEquals(1, entries.size());
    IProperty testProperty = entries.get(0);
    assertEquals(property, testProperty);
    assertEquals(testProperty.getKey(), key);
    assertEquals(testProperty.getValue(), value);
}
Also used : IProperty(com.archimatetool.model.IProperty)

Example 3 with IProperty

use of com.archimatetool.model.IProperty in project archi by archimatetool.

the class MetadataTests method testGetEntry.

@Test
public void testGetEntry() {
    String key = "some_key", value = "some_value";
    assertNull(metadata.getEntry("something"));
    IProperty property = metadata.addEntry(key, value);
    assertEquals(property, metadata.getEntry(key));
}
Also used : IProperty(com.archimatetool.model.IProperty) Test(org.junit.Test)

Example 4 with IProperty

use of com.archimatetool.model.IProperty in project archi by archimatetool.

the class MetadataTests method testEntryCreated.

@Test
public void testEntryCreated() throws Exception {
    String key = "some_key", value = "some_value";
    // Add a metadata entry as a property key/value pair
    IProperty property = IArchimateFactory.eINSTANCE.createProperty();
    property.setKey(key);
    property.setValue(value);
    metadata.getEntries().add(property);
    // Check entry is correct
    EList<IProperty> entries = metadata.getEntries();
    assertEquals(1, entries.size());
    IProperty testProperty = entries.get(0);
    assertEquals(property, testProperty);
    assertEquals(testProperty.getKey(), key);
    assertEquals(testProperty.getValue(), value);
    // Save to file
    File file = TestSupport.saveModel(model);
    assertTrue(file.exists());
    // Load it in again
    IArchimateModel testModel = TestSupport.loadModel(file);
    // Check it persisted
    EList<IProperty> testEntries = testModel.getMetadata().getEntries();
    assertEquals(1, testEntries.size());
    testProperty = testEntries.get(0);
    assertEquals(testProperty.getKey(), key);
    assertEquals(testProperty.getValue(), value);
}
Also used : IProperty(com.archimatetool.model.IProperty) File(java.io.File) IArchimateModel(com.archimatetool.model.IArchimateModel) Test(org.junit.Test)

Example 5 with IProperty

use of com.archimatetool.model.IProperty in project archi by archimatetool.

the class MetadataTests method testAddEntry.

@Test
public void testAddEntry() {
    String key = "some_key", value = "some_value";
    IProperty property = metadata.addEntry(key, value);
    assertNotNull(property);
    assertEquals(key, property.getKey());
    assertEquals(value, property.getValue());
    // Check entry is correct
    EList<IProperty> entries = metadata.getEntries();
    assertEquals(1, entries.size());
    assertEquals(property, entries.get(0));
}
Also used : IProperty(com.archimatetool.model.IProperty) Test(org.junit.Test)

Aggregations

IProperty (com.archimatetool.model.IProperty)20 EObject (org.eclipse.emf.ecore.EObject)7 Test (org.junit.Test)7 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)4 Point (org.eclipse.swt.graphics.Point)4 IArchimateElement (com.archimatetool.model.IArchimateElement)3 IProperties (com.archimatetool.model.IProperties)3 Command (org.eclipse.gef.commands.Command)3 EObjectNonNotifyingCompoundCommand (com.archimatetool.editor.model.commands.EObjectNonNotifyingCompoundCommand)2 IArchimateConcept (com.archimatetool.model.IArchimateConcept)2 IArchimateModel (com.archimatetool.model.IArchimateModel)2 IArchimateModelObject (com.archimatetool.model.IArchimateModelObject)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 CSVParseException (com.archimatetool.csv.CSVParseException)1 EObjectFeatureCommand (com.archimatetool.editor.model.commands.EObjectFeatureCommand)1 UpdatingTableColumnLayout (com.archimatetool.editor.ui.components.UpdatingTableColumnLayout)1 IAccessRelationship (com.archimatetool.model.IAccessRelationship)1 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)1 IDocumentable (com.archimatetool.model.IDocumentable)1 IInfluenceRelationship (com.archimatetool.model.IInfluenceRelationship)1