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);
}
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);
}
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));
}
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);
}
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));
}
Aggregations